diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-10-30 05:08:48 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-11-11 05:14:44 +0100 |
commit | 320d76f1581c40b05c359936a755126f38b1b0c9 (patch) | |
tree | 376cd7873713fccace47c221917aff15c2d92f81 | |
parent | 732b468d66a6341d3f1744548ad3ca7e90d1b06d (diff) |
daemon: don't crash if pa_realpath() fails
-rw-r--r-- | src/daemon/main.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c index 2e16c187..ff30908e 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -423,21 +423,24 @@ int main(int argc, char *argv[]) { pa_set_env("LD_BIND_NOW", "1"); - canonical_rp = pa_realpath(PA_BINARY); + if (!(canonical_rp = pa_realpath(PA_BINARY))) { - if ((rp = pa_readlink("/proc/self/exe"))) { + if ((rp = pa_readlink("/proc/self/exe"))) { - if (pa_streq(rp, canonical_rp)) - pa_assert_se(execv(rp, argv) == 0); - else - pa_log_warn("/proc/self/exe does not point to %s, cannot self execute. Are you playing games?", canonical_rp); + if (pa_streq(rp, canonical_rp)) + pa_assert_se(execv(rp, argv) == 0); + else + pa_log_warn("/proc/self/exe does not point to %s, cannot self execute. Are you playing games?", canonical_rp); - pa_xfree(rp); + pa_xfree(rp); - } else - pa_log_warn("Couldn't read /proc/self/exe, cannot self execute. Running in a chroot()?"); + } else + pa_log_warn("Couldn't read /proc/self/exe, cannot self execute. Running in a chroot()?"); - pa_xfree(canonical_rp); + pa_xfree(canonical_rp); + + } else + pa_log_warn("Couldn't canonicalize binary path, cannot self execute."); } #endif |