]> Dogcows Code - chaz/openbox/commitdiff
reap child processes when they die
authorDana Jansens <danakj@orodu.net>
Thu, 16 Jan 2003 23:38:21 +0000 (23:38 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 16 Jan 2003 23:38:21 +0000 (23:38 +0000)
src/openbox.cc

index d599e7bfc19ba4128b79eb472dd99d72630896ef..49849ea9e26e54b7f1b6130d59879d8c7e8bf023 100644 (file)
@@ -43,6 +43,10 @@ extern "C" {
 #  include <sys/select.h>
 #endif // HAVE_SYS_SELECT_H
 
+#ifdef    HAVE_SYS_WAIT_H
+#  include <sys/wait.h>
+#endif // HAVE_SYS_WAIT_H
+
 #include "gettext.h"
 #define _(str) gettext(str)
 }
@@ -62,6 +66,10 @@ void Openbox::signalHandler(int signal)
     openbox->restart();
     break;
 
+  case SIGCLD:
+    wait(NULL);
+    break;
+
   case SIGHUP:
   case SIGINT:
   case SIGTERM:
@@ -113,6 +121,10 @@ Openbox::Openbox(int argc, char **argv)
   sigaction(SIGTERM, &action, (struct sigaction *) 0);
   sigaction(SIGINT, &action, (struct sigaction *) 0);
   sigaction(SIGHUP, &action, (struct sigaction *) 0);
+  sigaction(SIGCLD, &action, (struct sigaction *) 0);
+
+  // anything that died while we were restarting won't give us a SIGCLD
+  while (waitpid(-1, NULL, WNOHANG) > 0);
 
   otk::Timer::initialize();
   otk::Property::initialize();
This page took 0.026325 seconds and 4 git commands to generate.