]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Respond to SIGCHLD with a wait so we don't leave zombies around.
authorRoy Marples <roy@marples.name>
Sat, 27 Jan 2007 13:31:39 +0000 (13:31 +0000)
committerRoy Marples <roy@marples.name>
Sat, 27 Jan 2007 13:31:39 +0000 (13:31 +0000)
ChangeLog
client.c
signals.c

index 21066ffbf92af63e1f9ee268b636b2adacac1f8d..103adda118a953580853687ed96b50cce75974c5 100644 (file)
--- 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
index 0ec43e7b7181a0353d564e48d2b82a15c1726144..2fc3180a7dcf1752a2bcaa976d5107a53debbf3e 100644 (file)
--- a/client.c
+++ b/client.c
@@ -19,7 +19,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <sys/types.h>
 #include <sys/select.h>
+#include <sys/wait.h>
 #include <arpa/inet.h>
 #ifdef __linux__
 #include <netinet/ether.h>
@@ -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;
 
index d3af679f75f4269dcc196a889e18f2886b320a67..5aa29e91ab0edf0b94e63315dafc5d087b6e8dbb 100644 (file)
--- 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