Projects
openEuler:24.03:SP1:Everything
audit
_service:tar_scm:backport-Use-atomic_int-if-ava...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-Use-atomic_int-if-available-for-signal-related-flags.patch of Package audit
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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2