summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bus/bus.c2
-rw-r--r--dbus/dbus-sysdeps-util-unix.c4
-rw-r--r--dbus/dbus-sysdeps-util-win.c2
-rw-r--r--dbus/dbus-sysdeps.h2
-rw-r--r--test/internals/syslog.c6
5 files changed, 8 insertions, 8 deletions
diff --git a/bus/bus.c b/bus/bus.c
index e80e7080..307c1586 100644
--- 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;
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index 99888f01..789729c7 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -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
diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c
index 111db9ea..abb10f70 100644
--- a/dbus/dbus-sysdeps-util-win.c
+++ b/dbus/dbus-sysdeps-util-win.c
@@ -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 */
}
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index f4b0ac97..a3205cfe 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -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,
diff --git a/test/internals/syslog.c b/test/internals/syslog.c
index 4f6b7c22..658281cb 100644
--- a/test/internals/syslog.c
+++ b/test/internals/syslog.c
@@ -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);
}