summaryrefslogtreecommitdiff
path: root/bus/bus.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-02 18:15:27 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-03 16:19:24 +0000
commit652a324fb6a1030b3525f8395bf5bc05ab50d3d7 (patch)
tree083e4ad5dc9411cab9d5fa69501f1f8f129ebf05 /bus/bus.c
parentc6e024834b8589bc09bcf341bbe97d648e417d16 (diff)
downloaddbus-652a324fb6a1030b3525f8395bf5bc05ab50d3d7.tar.gz
bus_context_log_and_set_error: add and use
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810 Reviewed-by: Philip Withnall
Diffstat (limited to 'bus/bus.c')
-rw-r--r--bus/bus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bus/bus.c b/bus/bus.c
index d7a068d7..091fbe28 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -1394,6 +1394,29 @@ bus_context_log_literal (BusContext *context,
}
}
+void
+bus_context_log_and_set_error (BusContext *context,
+ DBusSystemLogSeverity severity,
+ DBusError *error,
+ const char *name,
+ const char *msg,
+ ...)
+{
+ DBusError stack_error = DBUS_ERROR_INIT;
+ va_list args;
+
+ va_start (args, msg);
+ _dbus_set_error_valist (&stack_error, name, msg, args);
+ va_end (args);
+
+ /* If we hit OOM while setting the error, this will syslog "out of memory"
+ * which is itself an indication that something is seriously wrong */
+ bus_context_log_literal (context, DBUS_SYSTEM_LOG_SECURITY,
+ stack_error.message);
+
+ dbus_move_error (&stack_error, error);
+}
+
/*
* Log something about a message, usually that it was rejected.
*/