summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-util-unix.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-03-16 16:04:15 -0400
committerColin Walters <walters@verbum.org>2010-03-16 16:11:14 -0400
commitebfa7c02fd67777684d39389e25346819836dcca (patch)
tree93c2b9876ce960cbf2fa27dad9fb017184b7610b /dbus/dbus-sysdeps-util-unix.c
parentacbc751e28446696fee92c236cfef176786409d5 (diff)
parentce34415302af586ea6ca9b0da4b21a7025041ef7 (diff)
downloaddbus-ebfa7c02fd67777684d39389e25346819836dcca.tar.gz
Merge branch 'dbus-1.2'
Conflicts: bus/bus.c configure.in
Diffstat (limited to 'dbus/dbus-sysdeps-util-unix.c')
-rw-r--r--dbus/dbus-sysdeps-util-unix.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index 688ec19d..eaf32703 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -370,31 +370,58 @@ _dbus_init_system_log (void)
{
openlog ("dbus", LOG_PID, LOG_DAEMON);
}
-
/**
- * Log an informative message. Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
*
+ * @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
+ *
*/
-void
-_dbus_log_info (const char *msg, va_list args)
+void
+_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
{
- vsyslog (LOG_DAEMON|LOG_NOTICE, msg, args);
+ va_list args;
+
+ va_start (args, msg);
+
+ _dbus_system_logv (severity, msg, args);
+
+ va_end (args);
}
/**
- * Log a security-related message. Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
*
+ * @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
+ *
+ * If the FATAL severity is given, this function will terminate the program
+ * with an error code.
*/
-void
-_dbus_log_security (const char *msg, va_list args)
+void
+_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
{
- vsyslog (LOG_AUTH|LOG_NOTICE, msg, args);
+ int flags;
+ switch (severity)
+ {
+ case DBUS_SYSTEM_LOG_INFO:
+ flags = LOG_DAEMON | LOG_NOTICE;
+ break;
+ case DBUS_SYSTEM_LOG_SECURITY:
+ flags = LOG_AUTH | LOG_NOTICE;
+ break;
+ case DBUS_SYSTEM_LOG_FATAL:
+ flags = LOG_DAEMON|LOG_CRIT;
+ default:
+ return;
+ }
+
+ vsyslog (flags, msg, args);
+
+ if (severity == DBUS_SYSTEM_LOG_FATAL)
+ exit (1);
}
/** Installs a UNIX signal handler