]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
privops: wait for helper pid
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Dec 2015 15:09:02 +0000 (16:09 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Dec 2015 17:01:59 +0000 (18:01 +0100)
Save the pid of the helper process and replace wait() with waitpid().

privops.c

index 439b10aff837fe56d8a020f6060a52a2580a7988..e0967ab6a6e644bc7f148a0ceef6fbd91362510c 100644 (file)
--- a/privops.c
+++ b/privops.c
@@ -92,6 +92,7 @@ typedef struct {
 } PrvResponse;
 
 static int helper_fd = -1;
+static pid_t helper_pid;
 
 static int
 have_helper(void)
@@ -381,7 +382,7 @@ stop_helper(void)
   req.op = op_QUIT;
   send_request(&req);
 
-  wait(&status);
+  waitpid(helper_pid, &status, 0);
 }
 
 /* ======================================================================= */
@@ -518,6 +519,7 @@ PRV_Initialise(void)
     /* parent process */
     close(sock_pair[1]);
     helper_fd = sock_pair[0];
+    helper_pid = pid;
 
     /* stop the helper even when not exiting cleanly from the main function */
     atexit(stop_helper);