bus_context_log: divert messages to stderr if we're not using syslog
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 16 Mar 2011 14:52:39 +0000 (14:52 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 25 May 2011 17:16:37 +0000 (18:16 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
bus/bus.c

index 2c911c5..6b0dc08 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -23,6 +23,9 @@
 
 #include <config.h>
 #include "bus.h"
+
+#include <stdio.h>
+
 #include "activation.h"
 #include "connection.h"
 #include "services.h"
@@ -36,6 +39,7 @@
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-credentials.h>
 #include <dbus/dbus-internals.h>
+
 #ifdef DBUS_CYGWIN
 #include <signal.h>
 #endif
@@ -1283,7 +1287,14 @@ bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char
   va_list args;
 
   if (!context->syslog)
-    return;
+    {
+      /* we're not syslogging; just output to stderr */
+      va_start (args, msg);
+      vfprintf (stderr, msg, args);
+      fprintf (stderr, "\n");
+      va_end (args);
+      return;
+    }
 
   va_start (args, msg);
 
@@ -1336,7 +1347,7 @@ complain_about_message (BusContext     *context,
   const char *sender_loginfo;
   const char *proposed_recipient_loginfo;
 
-  if (error == NULL && !(context->syslog && log))
+  if (error == NULL && !log)
     return;
 
   if (sender != NULL)