diff options
author | Nikolay Nechaev <nikolay_nechaev@mail.ru> | 2024-05-17 19:49:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 21:49:54 +0200 |
commit | caf5b32d5cb71f2ac42471aa60f3d5d281e08335 (patch) | |
tree | c3a03bd8f8c73fc9ba9dd8980459da0f6c9bd617 /src | |
parent | 854696cfb50d759549720bd117f894158a5b759d (diff) | |
download | i3-caf5b32d5cb71f2ac42471aa60f3d5d281e08335.tar.gz i3-caf5b32d5cb71f2ac42471aa60f3d5d281e08335.zip |
Reap zombie children on i3 start (#5909)
One case when this might be useful is when i3 is restarted and there are
children that terminate after the previous i3 instance shut down but
before the new one set things up.
Fixes #5756
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1214,6 +1214,17 @@ int main(int argc, char *argv[]) { * when calling exit() */ atexit(i3_exit); + /* There might be children who died before we initialized the event loop, + * e.g., when restarting i3 (see #5756). + * To not carry zombie children around, raise the signal to invite libev to + * reap them. + * + * Note that there is no race condition between raising the signal below and + * entering the event loop later: the signal is just to notify libev that + * zombies might already be there. Actuall reaping will take place in the + * event loop anyway. */ + (void)raise(SIGCHLD); + sd_notify(1, "READY=1"); ev_loop(main_loop, 0); |