reap child processes when they die
Dana Jansens danakj@orodu.net
1 files changed,
12 insertions(+),
0 deletions(-)
jump to
M
src/openbox.cc
→
src/openbox.cc
@@ -43,6 +43,10 @@ #ifdef HAVE_SYS_SELECT_H
# 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) }@@ -60,6 +64,10 @@ switch (signal) {
case SIGUSR1: printf("Caught SIGUSR1 signal. Restarting.\n"); openbox->restart(); + break; + + case SIGCLD: + wait(NULL); break; case SIGHUP:@@ -113,6 +121,10 @@ sigaction(SIGFPE, &action, (struct sigaction *) 0);
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();