Skip to content

Commit

Permalink
Avoid creation of zombie process by load_config
Browse files Browse the repository at this point in the history
Previously, a zombie process was created when the process forked in
load_config terminates because the parent does not call wait or waitpid.
It is unreasonable to wait for the child because a user may exec their
autostart script into a long-running process. Instead, the parent now
simply ignores SIGCHLD which allows the child to be reaped immediately
upon termination.
  • Loading branch information
Joseph Eib committed Nov 30, 2022
1 parent e5bcb3f commit 3501ee0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "config.h"

#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
Expand Down Expand Up @@ -2536,8 +2537,10 @@ main(int argc, char *argv[])
LOGN("Successfully opened display");

setup();
if (conf_found)
if (conf_found) {
signal(SIGCHLD, SIG_IGN);
load_config(conf_path);
}
run();
close_wm();
free(font_name);
Expand Down

0 comments on commit 3501ee0

Please sign in to comment.