Set umask temporarily when creating files instead of changing the

mode after the fact.  This is slightly less error prone.
This commit is contained in:
Todd C. Miller
2017-03-21 16:21:17 -06:00
parent 2a37590b7d
commit 7668b4b42b
3 changed files with 15 additions and 6 deletions

View File

@@ -53,7 +53,6 @@ sudo_mkdir_parents(char *path, uid_t uid, gid_t gid, mode_t mode, bool quiet)
if (mkdir(path, mode) == 0) {
if (uid != (uid_t)-1 && gid != (gid_t)-1)
ignore_result(chown(path, uid, gid));
ignore_result(chmod(path, mode));
} else {
if (errno != EEXIST) {
if (!quiet)