From: Zbigniew Jędrzejewski-Szmek Date: Tue, 24 Apr 2018 11:46:58 +0000 (+0200) Subject: basic/audit-util: always log the reason when disabling audit logs X-Git-Tag: v239~361^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13bb68bbe37f0b39cd45234b09fb1a1da8302020;p=thirdparty%2Fsystemd.git basic/audit-util: always log the reason when disabling audit logs This state is cached, and it's seems OK to log at least once. --- diff --git a/src/basic/audit-util.c b/src/basic/audit-util.c index 00757c4f659..697a8421eec 100644 --- a/src/basic/audit-util.c +++ b/src/basic/audit-util.c @@ -82,10 +82,9 @@ bool use_audit(void) { fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT); if (fd < 0) { cached_use = !IN_SET(errno, EAFNOSUPPORT, EPROTONOSUPPORT, EPERM); - if (errno == EPERM) - log_debug_errno(errno, "Audit access prohibited, won't talk to audit"); - } - else { + if (!cached_use) + log_debug_errno(errno, "Won't talk to audit: %m"); + } else { cached_use = true; safe_close(fd); }