From: Lennart Poettering Date: Sat, 21 Jun 2008 11:55:52 +0000 (+0200) Subject: Properly check for home directory X-Git-Tag: 1.0_branch~2768 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2199b8e1adb3e9395e629da6a3b180d5e1ba15f0;p=profile%2Fivi%2Fpulseaudio.git Properly check for home directory --- diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 3217352..d259fb1 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1179,19 +1179,17 @@ static char *get_dir(mode_t m, const char *env_name) { return NULL; } - d = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse", h); - - if (stat(d, &st) < 0) { - pa_log_error("Failed to state home directory %s: %s", d, pa_cstrerror(errno)); - pa_xfree(d); + if (stat(h, &st) < 0) { + pa_log_error("Failed to stat home directory %s: %s", h, pa_cstrerror(errno)); return NULL; } if (st.st_uid != getuid()) { pa_log_error("Home directory %s not ours.", d); - pa_xfree(d); return NULL; } + + d = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse", h); } if (pa_make_secure_dir(d, m, (pid_t) -1, (pid_t) -1) < 0) {