chiark / gitweb /
basic/audit-util: always log the reason when disabling audit logs
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 24 Apr 2018 11:46:58 +0000 (13:46 +0200)
committerSven Eden <yamakuzure@gmx.net>
Thu, 28 Jun 2018 07:24:07 +0000 (09:24 +0200)
This state is cached, and it's seems OK to log at least once.

(cherry picked from commit 13bb68bbe37f0b39cd45234b09fb1a1da8302020)

src/basic/audit-util.c

index 973e2e6f865ffd4a45f77c74c1a4060ef13b55c9..a0a0ab06c98c03762d9479520c1dc6232c03bed9 100644 (file)
@@ -96,10 +96,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);
                 }