]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Do not suppress syslog test's stderr just because init is systemd
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 5 Apr 2013 12:28:54 +0000 (13:28 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 8 Apr 2013 11:17:28 +0000 (12:17 +0100)
This causes the test to fail. The assumption implicitly being made was
"if pid 1 is systemd, then every caller of _dbus_init_system_log() is a
systemd service" which is not valid for the regression test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63163
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
bus/bus.c
dbus/dbus-sysdeps-util-unix.c
dbus/dbus-sysdeps-util-win.c
dbus/dbus-sysdeps.h
test/internals/syslog.c

index e80e70805f50964434bede68db885885764468de..307c158612b92526eef25edc864f4f419b95ba4e 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -287,7 +287,7 @@ process_config_first_time_only (BusContext       *context,
   auth_mechanisms = NULL;
   pidfile = NULL;
 
-  _dbus_init_system_log ();
+  _dbus_init_system_log (TRUE);
 
   if (flags & BUS_CONTEXT_FLAG_SYSTEMD_ACTIVATION)
     context->systemd_activation = TRUE;
index 99888f01e51f3107fc8f72bfff8ab672c8fdcb2a..789729c7bc11ee1f130296032a3c8474f5960186 100644 (file)
@@ -428,14 +428,14 @@ _dbus_request_file_descriptor_limit (unsigned int limit)
 }
 
 void
-_dbus_init_system_log (void)
+_dbus_init_system_log (dbus_bool_t is_daemon)
 {
 #ifdef HAVE_SYSLOG_H
   int logopts = LOG_PID;
 
 #if HAVE_DECL_LOG_PERROR
 #ifdef HAVE_SYSTEMD
-  if (sd_booted () <= 0)
+  if (!is_daemon || sd_booted () <= 0)
 #endif
     logopts |= LOG_PERROR;
 #endif
index 111db9eadd293b097ec7541e8a13d22d4ca3ce86..abb10f70275d6a0b3a36a1dd8a986ef62a262c35 100644 (file)
@@ -262,7 +262,7 @@ _dbus_request_file_descriptor_limit (unsigned int limit)
 }
 
 void
-_dbus_init_system_log (void)
+_dbus_init_system_log (dbus_bool_t is_daemon)
 {
   /* OutputDebugStringA doesn't need any special initialization, do nothing */
 }
index f4b0ac97b927ae0bf8db4b532e71a320dd14bbe8..a3205cfe20e42ab95e7425302a8237cc5cd0baf3 100644 (file)
@@ -450,7 +450,7 @@ void _dbus_set_signal_handler (int               sig,
 dbus_bool_t _dbus_user_at_console (const char *username,
                                    DBusError  *error);
 
-void _dbus_init_system_log (void);
+void _dbus_init_system_log (dbus_bool_t is_daemon);
 
 typedef enum {
   DBUS_SYSTEM_LOG_INFO,
index 4f6b7c228d51b68ccae81d17080ccd45ef8a256a..658281cb553c0d18fd04c8529b381d422cf518ad 100644 (file)
@@ -54,7 +54,7 @@ test_syslog (Fixture *f,
 {
   if (g_test_trap_fork (0, 0))
     {
-      _dbus_init_system_log ();
+      _dbus_init_system_log (FALSE);
       _dbus_system_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23);
       /* should not be reached: exit 0 so the assertion in the main process
        * will fail */
@@ -66,7 +66,7 @@ test_syslog (Fixture *f,
 
   if (g_test_trap_fork (0, 0))
     {
-      _dbus_init_system_log ();
+      _dbus_init_system_log (FALSE);
       _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
       _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
       exit (0);
@@ -76,7 +76,7 @@ test_syslog (Fixture *f,
   g_test_trap_assert_stderr ("*" MESSAGE "42\n*" MESSAGE "666\n*");
 
   /* manual test (this is the best we can do on Windows) */
-  _dbus_init_system_log ();
+  _dbus_init_system_log (FALSE);
   _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
   _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
 }