[PATCH] it's baby eating time

ManMower manmower at is.fuckingabitch.com
Thu Jan 16 17:51:16 EST 2003


This patch makes openbox 3 reap its children when they exit.
-------------- next part --------------
Index: openbox.cc
===================================================================
RCS file: /cvs/cvsroot/openbox/src/openbox.cc,v
retrieving revision 1.123
diff -p -u -r1.123 openbox.cc
--- openbox.cc	2003/01/16 08:44:52	1.123
+++ openbox.cc	2003/01/16 22:49:19
@@ -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,9 @@ void Openbox::signalHandler(int signal)
     openbox->restart();
     break;
 
+  case SIGCLD:
+    wait(NULL);
+    break;
   case SIGHUP:
   case SIGINT:
   case SIGTERM:
@@ -113,6 +120,7 @@ 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);
 
   otk::Timer::initialize();
   otk::Property::initialize();
@@ -120,6 +128,10 @@ Openbox::Openbox(int argc, char **argv)
   _bindings = new Bindings();
 
   setMasterHandler(_actions); // set as the master event handler
+
+// anything that died while we were restarting won't give us a SIGCLD
+
+  while (waitpid(-1, NULL, WNOHANG) > 0);
 
   // create the mouse cursors we'll use
   _cursors.session = XCreateFontCursor(**otk::display, XC_left_ptr);


More information about the openbox mailing list