diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/caps.c | 13 | ||||
-rw-r--r-- | src/daemon/polkit.c | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/daemon/caps.c b/src/daemon/caps.c index ae07119c..8a49e373 100644 --- a/src/daemon/caps.c +++ b/src/daemon/caps.c @@ -109,6 +109,14 @@ void pa_limit_caps(void) { void pa_drop_caps(void) { cap_t caps; +#ifndef __OPTIMIZE__ + /* Valgrind doesn't not know set_caps, so we bypass it here -- but + * only in development builts.*/ + + if (getenv("VALGRIND") && !pa_have_caps()) + return; +#endif + pa_assert_se(prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) == 0); pa_assert_se(caps = cap_init()); @@ -123,7 +131,12 @@ pa_bool_t pa_have_caps(void) { cap_t caps; cap_flag_value_t flag = CAP_CLEAR; +#ifdef __OPTIMIZE__ pa_assert_se(caps = cap_get_proc()); +#else + if (!(caps = cap_get_proc())) + return FALSE; +#endif pa_assert_se(cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &flag) >= 0); pa_assert_se(cap_free(caps) == 0); diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index 256e3199..08155cf2 100644 --- a/src/daemon/polkit.c +++ b/src/daemon/polkit.c @@ -54,6 +54,11 @@ int pa_polkit_check(const char *action_id) { goto finish; } + /* There seems to be a bug in some versions of D-Bus that causes + * dbus_shutdown() to call exit() when a connection without this + * flag disabled was created during runtime.*/ + dbus_connection_set_exit_on_disconnect(bus, FALSE); + if (!(caller = polkit_caller_new_from_pid(bus, getpid(), &dbus_error))) { pa_log_error("Cannot get caller from PID: %s", dbus_error.message); goto finish; |