From 026a6bdd0ecdc68288b2167aed6dfd4e6f407edb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Jul 2008 01:25:33 +0200 Subject: Work around D-Bus bug that involves dbus_shutdown() to call exit() when it shouldn't. Patch from Coling Guthrie --- src/daemon/polkit.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/daemon') diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index 256e3199..dc0eee78 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 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; -- cgit From 4ccbc4dbe27b286b548ad27435c390131075fc8b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Jul 2008 21:22:43 +0200 Subject: reword comment on dbus a bit --- src/daemon/polkit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index dc0eee78..08155cf2 100644 --- a/src/daemon/polkit.c +++ b/src/daemon/polkit.c @@ -54,9 +54,9 @@ int pa_polkit_check(const char *action_id) { goto finish; } - /* There seems to be a bug in D-Bus that causes dbus_shutdown() to - * call exit() when a connection without this flag disabled was - * created during runtime.*/ + /* 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))) { -- cgit From 32f63f2a61e91b37e1725923f3894ee41d8a8cb7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 3 Aug 2008 16:16:22 +0200 Subject: allow running of PA with a valgring that doesn't know cap_set_caps --- src/daemon/caps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/daemon') 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); -- cgit