tree-wide: Include <libaudit.h> via libaudit-util.h
Let's keep the ifdeffery for the include in one place.
This commit is contained in:
@@ -6,10 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if HAVE_AUDIT
|
||||
# include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#include "fd-util.h"
|
||||
#include "iovec-util.h"
|
||||
#include "libaudit-util.h"
|
||||
@@ -100,14 +96,15 @@ int close_audit_fd(int fd) {
|
||||
}
|
||||
|
||||
int open_audit_fd_or_warn(void) {
|
||||
int fd = -EBADF;
|
||||
|
||||
#if HAVE_AUDIT
|
||||
/* If the kernel lacks netlink or audit support, don't worry about it. */
|
||||
fd = audit_open();
|
||||
int fd = audit_open();
|
||||
if (fd < 0)
|
||||
return log_full_errno(ERRNO_IS_NOT_SUPPORTED(errno) ? LOG_DEBUG : LOG_WARNING,
|
||||
errno, "Failed to connect to audit log, ignoring: %m");
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
#else
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "libaudit support not compiled in");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#if HAVE_AUDIT
|
||||
# include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool use_audit(void);
|
||||
|
||||
Reference in New Issue
Block a user