diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-11-05 14:09:59 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-11-05 14:12:18 -0500 |
commit | 8f645befba4c1c5df9c6f4ef832d217b1fdfed76 (patch) | |
tree | a70edce8558b46c6095e98a2d6ba690331bf0907 /src/common/util.c | |
parent | 4df419a4b19c3b4033b964ec73e82aa988034c81 (diff) | |
download | tor-8f645befba4c1c5df9c6f4ef832d217b1fdfed76.tar.gz tor-8f645befba4c1c5df9c6f4ef832d217b1fdfed76.zip |
11291: Fix warnings, add changes file, rename 'mask'.
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/util.c b/src/common/util.c index b616d1f389..50097dac93 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -2012,8 +2012,7 @@ check_private_dir(const char *dirname, cpd_check_t check, struct stat st; char *f; #ifndef _WIN32 - int mask = 0; - int perm = 0; + unsigned unwanted_bits = 0; const struct passwd *pw = NULL; uid_t running_uid; gid_t running_gid; @@ -2112,11 +2111,11 @@ check_private_dir(const char *dirname, cpd_check_t check, return -1; } if (check & (CPD_GROUP_OK|CPD_GROUP_READ)) { - mask = 0027; + unwanted_bits = 0027; } else { - mask = 0077; + unwanted_bits = 0077; } - if (st.st_mode & mask) { + if ((st.st_mode & unwanted_bits) != 0) { unsigned new_mode; if (check & CPD_CHECK_MODE_ONLY) { log_warn(LD_FS, "Permissions on directory %s are too permissive.", @@ -2129,7 +2128,7 @@ check_private_dir(const char *dirname, cpd_check_t check, if (check & CPD_GROUP_READ) { new_mode |= 0050; /* Group should have rx */ } - new_mode &= ~mask; /* Clear the other bits that we didn't want set...*/ + new_mode &= ~unwanted_bits; /* Clear the bits that we didn't want set...*/ if (chmod(dirname, new_mode)) { log_warn(LD_FS, "Could not chmod directory %s: %s", dirname, strerror(errno)); |