aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-05 13:43:58 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-05 13:43:58 -0400
commit1135405c8c6ea315cd035171770a6701edae57f0 (patch)
treeff9a736cd908a26b81ce359e5afac9f86891f335 /src/common/util.c
parent5a047cdc5feebf33302cf28c0f6dc092df0e58a8 (diff)
downloadtor-1135405c8c6ea315cd035171770a6701edae57f0.tar.gz
tor-1135405c8c6ea315cd035171770a6701edae57f0.zip
Fix a variable-shadowing bug in check_private_dir
We introduded a shadowed variable, thereby causing a log message to be wrong. Fixes 19578. I believe the bug was introduced by 54d7d31cba84232 in 0.2.2.29-beta.
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 538aeb108d..d61985e036 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2291,13 +2291,14 @@ check_private_dir,(const char *dirname, cpd_check_t check,
running_gid = getgid();
}
if (st.st_uid != running_uid) {
- const struct passwd *pw = NULL;
+ const struct passwd *pw_uid = NULL;
char *process_ownername = NULL;
- pw = tor_getpwuid(running_uid);
- process_ownername = pw ? tor_strdup(pw->pw_name) : tor_strdup("<unknown>");
+ pw_uid = tor_getpwuid(running_uid);
+ process_ownername = pw_uid ? tor_strdup(pw_uid->pw_name) :
+ tor_strdup("<unknown>");
- pw = tor_getpwuid(st.st_uid);
+ pw_uid = tor_getpwuid(st.st_uid);
log_warn(LD_FS, "%s is not owned by this user (%s, %d) but by "
"%s (%d). Perhaps you are running Tor as the wrong user?",