Commit 3861a426 authored by Simon McVittie's avatar Simon McVittie
Browse files

bus_context_log_literal: add simplified version of bus_context_log

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
parent 5b89e2a8
...@@ -1374,6 +1374,26 @@ nonnull (const char *maybe_null, ...@@ -1374,6 +1374,26 @@ nonnull (const char *maybe_null,
return (maybe_null ? maybe_null : if_null); return (maybe_null ? maybe_null : if_null);
} }
void
bus_context_log_literal (BusContext *context,
DBusSystemLogSeverity severity,
const char *msg)
{
if (!context->syslog)
{
fputs (msg, stderr);
fputc ('\n', stderr);
if (severity == DBUS_SYSTEM_LOG_FATAL)
_dbus_exit (1);
}
else
{
_dbus_system_log (severity, "%s%s", nonnull (context->log_prefix, ""),
msg);
}
}
/* /*
* Log something about a message, usually that it was rejected. * Log something about a message, usually that it was rejected.
*/ */
...@@ -1432,7 +1452,7 @@ complain_about_message (BusContext *context, ...@@ -1432,7 +1452,7 @@ complain_about_message (BusContext *context,
/* If we hit OOM while setting the error, this will syslog "out of memory" /* If we hit OOM while setting the error, this will syslog "out of memory"
* which is itself an indication that something is seriously wrong */ * which is itself an indication that something is seriously wrong */
if (log) if (log)
bus_context_log (context, DBUS_SYSTEM_LOG_SECURITY, "%s", bus_context_log_literal (context, DBUS_SYSTEM_LOG_SECURITY,
stack_error.message); stack_error.message);
dbus_move_error (&stack_error, error); dbus_move_error (&stack_error, error);
......
...@@ -121,6 +121,9 @@ void bus_context_log (BusContext ...@@ -121,6 +121,9 @@ void bus_context_log (BusContext
DBusSystemLogSeverity severity, DBusSystemLogSeverity severity,
const char *msg, const char *msg,
...) _DBUS_GNUC_PRINTF (3, 4); ...) _DBUS_GNUC_PRINTF (3, 4);
void bus_context_log_literal (BusContext *context,
DBusSystemLogSeverity severity,
const char *msg);
dbus_bool_t bus_context_check_security_policy (BusContext *context, dbus_bool_t bus_context_check_security_policy (BusContext *context,
BusTransaction *transaction, BusTransaction *transaction,
DBusConnection *sender, DBusConnection *sender,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment