代码拉取完成,页面将自动刷新
From 184f20c56576300343b8f8b60a8bebb185074485 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Fri, 26 Apr 2024 12:44:56 -0400
Subject: [PATCH] Use atomic_int if available for signal related flags
Conflict:src/auditd.c
Reference:https://github.com/linux-audit/audit-userspace/commit/184f20c56576300343b8f8b60a8bebb185074485
---
configure.ac | 7 ++++++-
src/auditd-event.c | 5 ++++-
src/auditd.c | 9 ++++++---
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8644ccc..61d32a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,12 @@ AC_LINK_IFELSE(
[AC_DEFINE(HAVE_STRNDUPA, 1, [Let us know if we have it or not])],
[]
)
-
+AC_CHECK_HEADERS([stdatomic.h], [
+ AC_DEFINE([HAVE_ATOMIC], 1, [Define to 1 if you have the <stdatomic.h> header file.])
+ AC_DEFINE([ATOMIC_INT], atomic_int, [Define atomic_int if you have the <stdatomic.h> header file.])
+ ], [
+ AC_DEFINE([ATOMIC_INT], int, [Define to the type of an int if <stdatomic.h> is not available.])
+])
AC_MSG_CHECKING(__attr_access support)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
diff --git a/src/auditd-event.c b/src/auditd-event.c
index c74b420..74c4fbd 100644
--- a/src/auditd-event.c
+++ b/src/auditd-event.c
@@ -36,6 +36,9 @@
#include <limits.h> /* POSIX_HOST_NAME_MAX */
#include <ctype.h> /* toupper */
#include <libgen.h> /* dirname */
+#ifdef HAVE_ATOMIC
+#include <stdatomic.h>
+#endif
#include "auditd-event.h"
#include "auditd-dispatch.h"
#include "auditd-listen.h"
@@ -45,7 +48,7 @@
#include "auparse-idata.h"
/* This is defined in auditd.c */
-extern volatile int stop;
+extern volatile ATOMIC_INT stop;
/* Local function prototypes */
static void send_ack(const struct auditd_event *e, int ack_type,
diff --git a/src/auditd.c b/src/auditd.c
index 901f741..aebb919 100644
--- a/src/auditd.c
+++ b/src/auditd.c
@@ -38,6 +38,9 @@
#include <pthread.h>
#include <sys/utsname.h>
#include <getopt.h>
+#ifdef HAVE_ATOMIC
+#include <stdatomic.h>
+#endif
#include "libaudit.h"
#include "auditd-event.h"
@@ -62,7 +65,7 @@
#define SUBJ_LEN 4097
/* Global Data */
-volatile int stop = 0;
+volatile ATOMIC_INT stop = 0;
/* Local data */
static int fd = -1, pipefds[2] = {-1, -1};
@@ -72,8 +75,8 @@ static const char *state_file = "/var/run/auditd.state";
static int init_pipe[2];
static int do_fork = 1, opt_aggregate_only = 0, config_dir_set = 0;
static struct auditd_event *cur_event = NULL, *reconfig_ev = NULL;
-static int hup_info_requested = 0;
-static int usr1_info_requested = 0, usr2_info_requested = 0;
+static ATOMIC_INT hup_info_requested = 0;
+static ATOMIC_INT usr1_info_requested = 0, usr2_info_requested = 0;
static char subj[SUBJ_LEN];
static uint32_t session;
static int hup_flag = 0;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。