]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 24 Apr 2018 12:10:27 +0000 (14:10 +0200)
This state is cached, and it's seems OK to log at least once.

src/basic/audit-util.c

index 00757c4f6595bf7cdafb45a028b91a94434a42e6..697a8421eec75f3e937025031a989ab05a806c2d 100644 (file)
@@ -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);
                 }