summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-09-27 11:59:58 +0200
committerantirez <antirez@gmail.com>2019-09-27 11:59:58 +0200
commit82845f8d045a1fdbac17cf1959ad51906a8840ed (patch)
treee98808e09115dcccd094327ce5e1ce5d6e9d8006
parentbeb1356b5bdeb38eecb5c0bef509d3d4b3f2d3c0 (diff)
downloadredis-82845f8d045a1fdbac17cf1959ad51906a8840ed.tar.gz
TerminateModuleForkChild(): use wait4 for safety.
In theory currently there is only one active child, but the API may change or for bugs in the implementation we may have several (it was like that for years because of a bug). Better to wait for a specific pid and avoid consuing other pending children information.
-rw-r--r--src/module.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c
index d3b37a3d8..cee7a85a9 100644
--- a/src/module.c
+++ b/src/module.c
@@ -5193,7 +5193,8 @@ void TerminateModuleForkChild(int wait) {
serverLog(LL_NOTICE,"Killing running module fork child: %ld",
(long) server.module_child_pid);
if (kill(server.module_child_pid,SIGUSR1) != -1 && wait) {
- while(wait3(&statloc,0,NULL) != server.module_child_pid);
+ while(wait4(server.module_child_pid,&statloc,0,NULL) !=
+ server.module_child_pid);
}
/* Reset the buffer accumulating changes while the child saves. */
server.module_child_pid = -1;