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:
Daan De Meyer
2025-05-21 14:05:56 +02:00
parent 9f23910935
commit cdd5fac068
7 changed files with 13 additions and 36 deletions
+2 -13
View File
@@ -3,19 +3,13 @@
#include <errno.h>
#include "audit-fd.h"
#if HAVE_AUDIT
# include <stdbool.h>
# include "libaudit-util.h"
# include "capability-util.h"
#include "capability-util.h"
#include "libaudit-util.h"
static bool initialized = false;
static int audit_fd = -EBADF;
#endif
int get_core_audit_fd(void) {
#if HAVE_AUDIT
if (!initialized) {
if (have_effective_cap(CAP_AUDIT_WRITE) <= 0)
audit_fd = -EPERM;
@@ -26,15 +20,10 @@ int get_core_audit_fd(void) {
}
return audit_fd;
#else
return -EAFNOSUPPORT;
#endif
}
void close_core_audit_fd(void) {
#if HAVE_AUDIT
close_audit_fd(audit_fd);
initialized = true;
audit_fd = -ECONNRESET;
#endif
}
+1 -4
View File
@@ -12,10 +12,6 @@
#include <sys/wait.h>
#include <unistd.h>
#if HAVE_AUDIT
#include <libaudit.h>
#endif
#include "sd-daemon.h"
#include "sd-messages.h"
#include "sd-path.h"
@@ -58,6 +54,7 @@
#include "io-util.h"
#include "iovec-util.h"
#include "label-util.h"
#include "libaudit-util.h"
#include "load-fragment.h"
#include "locale-setup.h"
#include "log.h"
+1 -3
View File
@@ -7,9 +7,6 @@
#include <errno.h>
#include <selinux/avc.h>
#include <selinux/selinux.h>
#if HAVE_AUDIT
#include <libaudit.h>
#endif
#include "sd-bus.h"
@@ -18,6 +15,7 @@
#include "bus-util.h"
#include "errno-util.h"
#include "format-util.h"
#include "libaudit-util.h"
#include "log.h"
#include "path-util.h"
#include "selinux-util.h"