blob: e4aa8fda322d9f8432cf3685d5c6d62aea30ba75 [file] [log] [blame]
From b9040acdba1245f8cdf5e94384830e3d04fde98a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 22 Jul 2020 21:32:14 -0700
Subject: [PATCH] Replace sigignore with signal API
sigignore has been deprecated in glibc 2.32+ [1] and eventually it will be
removed, therefore substitute it
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=02802fafcf6e11ea3f998f685035ffe568dfddeb
Upstream-Status: Submitted [https://github.com/memcached/memcached/pull/702]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 1 -
memcached.c | 16 ++--------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index ffc98b2..4567b30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -630,7 +630,6 @@ AC_CHECK_FUNCS(mlockall)
AC_CHECK_FUNCS(getpagesizes)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(memcntl)
-AC_CHECK_FUNCS(sigignore)
AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(preadv)
AC_CHECK_FUNCS(pread)
diff --git a/memcached.c b/memcached.c
index 9cb778d..91ced9e 100644
--- a/memcached.c
+++ b/memcached.c
@@ -8292,18 +8292,6 @@ static void sig_usrhandler(const int sig) {
stop_main_loop = GRACE_STOP;
}
-#ifndef HAVE_SIGIGNORE
-static int sigignore(int sig) {
- struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = 0 };
-
- if (sigemptyset(&sa.sa_mask) == -1 || sigaction(sig, &sa, 0) == -1) {
- return -1;
- }
- return 0;
-}
-#endif
-
-
/*
* On systems that supports multiple page sizes we may reduce the
* number of TLB-misses by using the biggest available page size
@@ -9996,7 +9984,7 @@ int main (int argc, char **argv) {
/* daemonize if requested */
/* if we want to ensure our ability to dump core, don't chdir to / */
if (do_daemonize) {
- if (sigignore(SIGHUP) == -1) {
+ if (signal(SIGHUP, SIG_IGN) == SIG_ERR) {
perror("Failed to ignore SIGHUP");
}
if (daemonize(maxcore, settings.verbose) == -1) {
@@ -10146,7 +10134,7 @@ int main (int argc, char **argv) {
* ignore SIGPIPE signals; we can use errno == EPIPE if we
* need that information
*/
- if (sigignore(SIGPIPE) == -1) {
+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("failed to ignore SIGPIPE; sigaction");
exit(EX_OSERR);
}
--
2.27.0