From 07af048dd225b3f4ced28537470d8eb237fa3828 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 29 Mar 2016 12:15:15 -0700 Subject: Quote the DBUS_SESSION_BUS_ADDRESS variable in the shell file Some D-Bus daemon versions set multiple addresses separated by semi-colon, which breaks sourcing of the file. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94746 Signed-off-by: Thiago Macieira Reviewed-by: Simon McVittie --- tools/dbus-launch-x11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index c7e33309..a09444be 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -414,7 +414,7 @@ set_address_in_file (char *address, pid_t pid, Window wid) "# If the DBUS_SESSION_BUS_ADDRESS environment variable is set, it will\n" "# be used rather than this file.\n" "# See \"man dbus-launch\" for more details.\n" - "DBUS_SESSION_BUS_ADDRESS=%s\n" + "DBUS_SESSION_BUS_ADDRESS='%s'\n" "DBUS_SESSION_BUS_PID=%ld\n" "DBUS_SESSION_BUS_WINDOWID=%ld\n", get_machine_uuid (), -- cgit v1.2.3 From e0f26388f7536f0d5f618194469826c2bad9401b Mon Sep 17 00:00:00 2001 From: Руслан Ижбулатов Date: Thu, 23 Jun 2016 12:26:45 +0000 Subject: Use dbus_set_error_from_message() to check for an error Do not rely on dbus_message_get_args() to turn an ERROR message into DBusError. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=96653 Reviewed-by: Simon McVittie --- test/dbus-daemon.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 72bcd08c..99d2bc63 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -526,7 +526,18 @@ test_processid (Fixture *f, while (m == NULL) test_main_context_iterate (f->ctx, TRUE); - if (dbus_message_get_args (m, &error, + if (dbus_set_error_from_message (&error, m)) + { + g_assert_cmpstr (error.name, ==, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN); + +#ifdef PID_SHOULD_WORK + g_error ("Expected pid to be passed, but got %s: %s", + error.name, error.message); +#endif + + dbus_error_free (&error); + } + else if (dbus_message_get_args (m, &error, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID)) { @@ -545,14 +556,7 @@ test_processid (Fixture *f, } else { - g_assert_cmpstr (error.name, ==, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN); - -#ifdef PID_SHOULD_WORK - g_error ("Expected pid to be passed, but got %s: %s", - error.name, error.message); -#endif - - dbus_error_free (&error); + g_error ("Unexpected error: %s: %s", error.name, error.message); } } -- cgit v1.2.3 From 2fe59f1892825ced87c45ae25d9f5795b1d735b6 Mon Sep 17 00:00:00 2001 From: WaLyong Cho Date: Tue, 7 Jun 2016 23:26:42 +0900 Subject: activation: set children oom_score_adj to 0 If dbus is running as systemd service, dbus daemon is running with oom_score_adj -900 by OOMScoreAdjust=-900. And children will also have same value with dbus daemon. To avoid this, set the child itself values after fork () to 0. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32851 Reviewed-by: Simon McVittie --- dbus/dbus-spawn.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index ddd254dc..45f3d87d 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -1354,6 +1354,26 @@ _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p, } else if (grandchild_pid == 0) { +#ifdef __linux__ + int fd = -1; + +#ifdef O_CLOEXEC + fd = open ("/proc/self/oom_score_adj", O_WRONLY | O_CLOEXEC); +#endif + + if (fd < 0) + { + fd = open ("/proc/self/oom_score_adj", O_WRONLY); + _dbus_fd_set_close_on_exec (fd); + } + + if (fd >= 0) + { + if (write (fd, "0", sizeof (char)) < 0) + _dbus_warn ("writing oom_score_adj error: %s\n", strerror (errno)); + _dbus_close (fd, NULL); + } +#endif /* Go back to ignoring SIGPIPE, since it's evil */ signal (SIGPIPE, SIG_IGN); -- cgit v1.2.3