From: Roy Marples Date: Sat, 27 Jan 2007 13:31:39 +0000 (+0000) Subject: Respond to SIGCHLD with a wait so we don't leave zombies around. X-Git-Tag: v3.2.3~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15493e55ffd511f8651b98edde70654dfb4870c1;p=thirdparty%2Fdhcpcd.git Respond to SIGCHLD with a wait so we don't leave zombies around. --- diff --git a/ChangeLog b/ChangeLog index 21066ffb..103adda1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +We now work with SIGCHLD and call wait so that we don't leave any +zombies lying around. For infinite timeout, we now resent the last request at +TIMEOUT_MINI intervals until TIMEOUT_MINI_INF is reached, thanks to siadak. We now return a non zero exit code on SIGTERM and SIGINT if we have not diff --git a/client.c b/client.c index 0ec43e7b..2fc3180a 100644 --- a/client.c +++ b/client.c @@ -19,7 +19,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include +#include #include #ifdef __linux__ #include @@ -232,19 +234,24 @@ int dhcp_run (const options_t *options) { switch (sig) { + case SIGCHLD: + /* Silently ignore this signal and wait for it + This stops zombies */ + wait (0); + break; case SIGINT: - logger (LOG_INFO, "receieved SIGINT, stopping"); + logger (LOG_INFO, "received SIGINT, stopping"); retval = (! daemonised); goto eexit; case SIGTERM: - logger (LOG_INFO, "receieved SIGTERM, stopping"); + logger (LOG_INFO, "received SIGTERM, stopping"); retval = (! daemonised); goto eexit; case SIGALRM: - logger (LOG_INFO, "receieved SIGALRM, renewing lease"); + logger (LOG_INFO, "received SIGALRM, renewing lease"); switch (state) { case STATE_BOUND: @@ -277,7 +284,7 @@ int dhcp_run (const options_t *options) } else logger (LOG_ERR, - "receieved SIGHUP, but no we have lease to release"); + "received SIGHUP, but no we have lease to release"); retval = 0; goto eexit; diff --git a/signals.c b/signals.c index d3af679f..5aa29e91 100644 --- a/signals.c +++ b/signals.c @@ -57,6 +57,7 @@ void signal_setup(void) signal (SIGALRM, signal_handler); signal (SIGTERM, signal_handler); signal (SIGINT, signal_handler); + signal (SIGCHLD, signal_handler); } /* Quick little function to setup the rfds. Will return the