diff --git a/src/shared/libaudit-util.c b/src/shared/libaudit-util.c index beac269f21..147aaf9a1d 100644 --- a/src/shared/libaudit-util.c +++ b/src/shared/libaudit-util.c @@ -19,8 +19,10 @@ DLSYM_PROTOTYPE(audit_log_acct_message) = NULL; DLSYM_PROTOTYPE(audit_log_user_avc_message) = NULL; DLSYM_PROTOTYPE(audit_log_user_comm_message) = NULL; static DLSYM_PROTOTYPE(audit_open) = NULL; +#endif int dlopen_libaudit(void) { +#if HAVE_AUDIT ELF_NOTE_DLOPEN("libaudit", "Support for Audit logging", ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED, @@ -35,8 +37,12 @@ int dlopen_libaudit(void) { DLSYM_ARG(audit_log_user_avc_message), DLSYM_ARG(audit_log_user_comm_message), DLSYM_ARG(audit_open)); +#else + return -EOPNOTSUPP; +#endif } +#if HAVE_AUDIT static int try_audit_request(int fd) { struct iovec iov; struct msghdr mh; diff --git a/src/shared/libaudit-util.h b/src/shared/libaudit-util.h index b4e7a56c50..f33258f9e1 100644 --- a/src/shared/libaudit-util.h +++ b/src/shared/libaudit-util.h @@ -3,6 +3,8 @@ #include "forward.h" +int dlopen_libaudit(void); + #if HAVE_AUDIT # include /* IWYU pragma: export */ @@ -11,8 +13,6 @@ extern DLSYM_PROTOTYPE(audit_log_acct_message); extern DLSYM_PROTOTYPE(audit_log_user_avc_message); extern DLSYM_PROTOTYPE(audit_log_user_comm_message); - -int dlopen_libaudit(void); #endif bool use_audit(void);