diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-02-19 12:08:59 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-08-06 17:12:37 +0100 |
commit | e3e388a1ef8859cfb672bd92d955ce90aafb7f7d (patch) | |
tree | d2b8ac0ca411a014f487ae1ff256f54b6a63fb2c /bus/audit.c | |
parent | 327a52e4eb90c94dc47579b7890974b65f2f9e53 (diff) | |
download | dbus-e3e388a1ef8859cfb672bd92d955ce90aafb7f7d.tar.gz |
audit: use DBUS_SYSTEM_LOG_WARNING if we cannot open the audit fd
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/audit.c')
-rw-r--r-- | bus/audit.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bus/audit.c b/bus/audit.c index 97f7d1c4..1aa1e184 100644 --- a/bus/audit.c +++ b/bus/audit.c @@ -49,20 +49,26 @@ static int audit_fd = -1; * Open the libaudit fd if appropriate. */ void -bus_audit_init(void) +bus_audit_init (BusContext *context) { #ifdef HAVE_LIBAUDIT audit_fd = audit_open (); if (audit_fd < 0) { + int e = errno; + /* If kernel doesn't support audit, bail out */ - if (errno == EINVAL || errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT) + if (e == EINVAL || e == EPROTONOSUPPORT || e == EAFNOSUPPORT) return; + /* If user bus, bail out */ - if (errno == EPERM && getuid() != 0) + if (e == EPERM && getuid () != 0) return; - _dbus_warn ("Failed opening connection to the audit subsystem"); + + bus_context_log (context, DBUS_SYSTEM_LOG_WARNING, + "Failed to open connection to the audit subsystem: %s", + _dbus_strerror (e)); } #endif /* HAVE_LIBAUDIT */ } |