From fb7cffa3c67313387b1ea39cccd9a6191f4e8f56 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Tue, 5 Feb 2013 14:52:22 -0600 Subject: [PATCH 1/3] Add support for systems without syslog.h This patch disables logging for systems which do not have syslog.h, such as QNX. --- configure.ac | 3 +++ dbus/dbus-sysdeps-util-unix.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index 1c8b705..262d8a8 100644 --- a/configure.ac +++ b/configure.ac @@ -764,6 +764,9 @@ AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)]) dnl needed on darwin for NAME_MAX AC_CHECK_HEADERS(sys/syslimits.h) +dnl QNX doesn't have syslog.h +AC_CHECK_HEADERS(syslog.h) + dnl Make it easy to check if we have MSG_NOSIGNAL without actually having to include sys/socket.h AC_CHECK_DECLS([MSG_NOSIGNAL], [], [], [[ #include #include ]]) diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 6cff3fe..64c22d9 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -49,7 +49,10 @@ #include #include #include + +#ifdef HAVE_SYSLOG_H #include +#endif #ifdef HAVE_SYS_SYSLIMITS_H #include @@ -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) { @@ -496,6 +504,8 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args vsyslog (flags, msg, args); +#endif + if (severity == DBUS_SYSTEM_LOG_FATAL) exit (1); } -- 1.8.0.msysgit.0