jvinet / knock

A port-knocking daemon
http://www.zeroflux.org/projects/knock
GNU General Public License v2.0
559 stars 115 forks source link

reap children #11

Closed infinity0 closed 9 years ago

infinity0 commented 10 years ago

The Debian version has had this patch for a while, which fixes a bug where knockd keeps a lot of children around.

--- a/src/knockd.c
+++ b/src/knockd.c
@@ -367,8 +367,9 @@

 void child_exit(int signum)
 {
-   /* child wants to exit, let em die */
-   wait(NULL);
+   int status;
+
+   while ( waitpid( (pid_t)-1, &status, WNOHANG ) > 0 ) continue;
    return;
 }
jvinet commented 9 years ago

Merged PR