From 2e572717c50005e93e5f951d5d5d0c7f925d793d Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 14 Oct 2004 20:24:00 +0000 Subject: [PATCH] fixed bug with zombies after wmaker crashed --- src/monitor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/monitor.c b/src/monitor.c index 69ceee63..d502d984 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -90,7 +90,7 @@ int showCrashDialog(int sig) int MonitorLoop(int argc, char **argv) { - pid_t pid; + pid_t pid, exited; char **child_argv= wmalloc(sizeof(char*)*(argc+2)); int i, status; time_t last_start; @@ -105,7 +105,7 @@ int MonitorLoop(int argc, char **argv) last_start= time(NULL); /* Start Window Maker */ - pid= fork(); + pid = fork(); if (pid == 0) { execvp(child_argv[0], child_argv); @@ -118,12 +118,15 @@ int MonitorLoop(int argc, char **argv) exit(1); } - if (waitpid(pid, &status, 0) < 0) + if ((exited=waitpid(-1, &status, 0)) < 0) { wsyserror(_("Error during monitoring of Window Maker process.")); break; } + if (exited != pid) + continue; + child_argv[argc]= "--for-real-"; /* Check if the wmaker process exited due to a crash */ -- 2.11.4.GIT