diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-08-23 16:10:03 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-09-21 11:25:48 +0100 |
commit | a4e9dc6780cc2187257f6eb232f1b241e78900ba (patch) | |
tree | 9b0deefbd26ef979857e16198f23a28c8447baa2 /dbus/dbus-sysdeps-util-unix.c | |
parent | 14ed371845c50aa8fe5849c373ca2c65e96ec153 (diff) | |
download | dbus-a4e9dc6780cc2187257f6eb232f1b241e78900ba.tar.gz |
Cope with Unixes that don't have LOG_PERROR, like Solaris 10
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-sysdeps-util-unix.c')
-rw-r--r-- | dbus/dbus-sysdeps-util-unix.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index a80f6430..d57e6aad 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -422,11 +422,16 @@ _dbus_request_file_descriptor_limit (unsigned int limit) #endif } -void +void _dbus_init_system_log (void) { +#ifdef HAVE_DECL_LOG_PERROR openlog ("dbus", LOG_PID | LOG_PERROR, LOG_DAEMON); +#else + openlog ("dbus", LOG_PID, LOG_DAEMON); +#endif } + /** * Log a message to the system log file (e.g. syslog on Unix). * @@ -476,6 +481,19 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args return; } +#ifndef HAVE_DECL_LOG_PERROR + { + /* vsyslog() won't write to stderr, so we'd better do it */ + va_list tmp; + + DBUS_VA_COPY (tmp, args); + fprintf (stderr, "dbus[" DBUS_PID_FORMAT "]: ", _dbus_getpid ()); + vfprintf (stderr, msg, tmp); + fputc ('\n', stderr); + va_end (tmp); + } +#endif + vsyslog (flags, msg, args); if (severity == DBUS_SYSTEM_LOG_FATAL) |