From 497299df830483556c9e3ba2e359dbbefc3cd729 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Fri, 20 Aug 2010 14:26:10 -0700 Subject: [PATCH] split out sigterm handling from sigsegv, so that term is always handled. --- src/redis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/redis.c b/src/redis.c index b8e4d3191..3b3711f51 100644 --- a/src/redis.c +++ b/src/redis.c @@ -778,6 +778,7 @@ void initServer() { if (!server.dumpcore) { setupSigSegvAction(); } + setupSigTermAction(); server.mainthread = pthread_self(); server.devnull = fopen("/dev/null","w"); @@ -1532,11 +1533,15 @@ void setupSigSegvAction(void) { sigaction (SIGFPE, &act, NULL); sigaction (SIGILL, &act, NULL); sigaction (SIGBUS, &act, NULL); +} + +void setupSigTermAction(void) { + struct sigaction act; + sigemptyset (&act.sa_mask); act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND; act.sa_handler = sigtermHandler; sigaction (SIGTERM, &act, NULL); - return; } #else /* HAVE_BACKTRACE */ -- GitLab