1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

audit: disable if cannot create NETLINK_AUDIT socket

This commit is contained in:
Giuseppe Scrivano 2016-09-28 18:26:25 +02:00
parent 77531863ca
commit f006b30bd5

View File

@ -92,8 +92,11 @@ bool use_audit(void) {
int fd; int fd;
fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT); fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT);
if (fd < 0) if (fd < 0) {
cached_use = errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT; cached_use = !IN_SET(errno, EAFNOSUPPORT, EPROTONOSUPPORT, EPERM);
if (errno == EPERM)
log_debug_errno(errno, "Audit access prohibited, won't talk to audit");
}
else { else {
cached_use = true; cached_use = true;
safe_close(fd); safe_close(fd);