diff options
author | Matt Fischer <matt.fischer@garmin.com> | 2013-02-20 15:27:20 -0600 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-02-21 13:12:39 +0000 |
commit | 0ebd4ae912568caa40b714ba166211fa31b82af8 (patch) | |
tree | 508c528b1bd497ec66f37246ee8164b7105e96a9 | |
parent | 0484cf1a3cde1a5993425c938645f762db738033 (diff) | |
download | dbus-0ebd4ae912568caa40b714ba166211fa31b82af8.tar.gz |
Add support for systems without syslog.h
This patch disables the use of syslog for systems which
do not have it, such as QNX. Log messages are still
printed to stderr.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | dbus/dbus-sysdeps-util-unix.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 6cff3fe2..7beab209 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -49,7 +49,10 @@ #include <sys/socket.h> #include <dirent.h> #include <sys/un.h> + +#ifdef HAVE_SYSLOG_H #include <syslog.h> +#endif #ifdef HAVE_SYS_SYSLIMITS_H #include <sys/syslimits.h> @@ -425,11 +428,15 @@ _dbus_request_file_descriptor_limit (unsigned int limit) void _dbus_init_system_log (void) { +#ifdef HAVE_SYSLOG_H + #if HAVE_DECL_LOG_PERROR openlog ("dbus", LOG_PID | LOG_PERROR, LOG_DAEMON); #else openlog ("dbus", LOG_PID, LOG_DAEMON); #endif + +#endif } /** @@ -465,6 +472,7 @@ _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) void _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args) { +#ifdef HAVE_SYSLOG_H int flags; switch (severity) { @@ -481,7 +489,10 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args return; } -#ifndef HAVE_DECL_LOG_PERROR + vsyslog (flags, msg, args); +#endif + +#if !defined(HAVE_SYSLOG_H) || !HAVE_DECL_LOG_PERROR { /* vsyslog() won't write to stderr, so we'd better do it */ va_list tmp; @@ -494,8 +505,6 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args } #endif - vsyslog (flags, msg, args); - if (severity == DBUS_SYSTEM_LOG_FATAL) exit (1); } |