diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-16 23:38:21 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-16 23:38:21 +0000 |
| commit | 44358dfbaa66592da813ce84e88675dfa293384f (patch) | |
| tree | 297d87e63bc0a218ed2df08cfef8b42bb9c084bb /src/openbox.cc | |
| parent | af1ac846ccb5fab8a3c83d8688db3d3f96f5a98b (diff) | |
reap child processes when they die
Diffstat (limited to 'src/openbox.cc')
| -rw-r--r-- | src/openbox.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/openbox.cc b/src/openbox.cc index d599e7bf..49849ea9 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -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(); |
