mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
fixed bug with zombies after wmaker crashed
This commit is contained in:
@@ -90,7 +90,7 @@ int showCrashDialog(int sig)
|
|||||||
|
|
||||||
int MonitorLoop(int argc, char **argv)
|
int MonitorLoop(int argc, char **argv)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid, exited;
|
||||||
char **child_argv= wmalloc(sizeof(char*)*(argc+2));
|
char **child_argv= wmalloc(sizeof(char*)*(argc+2));
|
||||||
int i, status;
|
int i, status;
|
||||||
time_t last_start;
|
time_t last_start;
|
||||||
@@ -105,7 +105,7 @@ int MonitorLoop(int argc, char **argv)
|
|||||||
last_start= time(NULL);
|
last_start= time(NULL);
|
||||||
|
|
||||||
/* Start Window Maker */
|
/* Start Window Maker */
|
||||||
pid= fork();
|
pid = fork();
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
execvp(child_argv[0], child_argv);
|
execvp(child_argv[0], child_argv);
|
||||||
@@ -118,12 +118,15 @@ int MonitorLoop(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waitpid(pid, &status, 0) < 0)
|
if ((exited=waitpid(-1, &status, 0)) < 0)
|
||||||
{
|
{
|
||||||
wsyserror(_("Error during monitoring of Window Maker process."));
|
wsyserror(_("Error during monitoring of Window Maker process."));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exited != pid)
|
||||||
|
continue;
|
||||||
|
|
||||||
child_argv[argc]= "--for-real-";
|
child_argv[argc]= "--for-real-";
|
||||||
|
|
||||||
/* Check if the wmaker process exited due to a crash */
|
/* Check if the wmaker process exited due to a crash */
|
||||||
|
|||||||
Reference in New Issue
Block a user