summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Lefevre <vincent@vinc17.net>2022-02-17 02:42:31 +0200
committerAlexander Naumov <alexander_naumov@opensuse.org>2022-02-17 02:42:31 +0200
commit1bfe555cd334feccdf55a0fd2891f743b2ffc7a0 (patch)
tree477bf9a238c31fa5d0b7aebaa83e4b1f5308fd39
parent7da80e460b546255ca3fccb3aa2e8cae796457a9 (diff)
downloadscreen-1bfe555cd334feccdf55a0fd2891f743b2ffc7a0.tar.gz
Avoid zombies after shell exit
As documented in libutempter: "During execution of the privileged process spawned by these functions, SIGCHLD signal handler will be temporarily set to the default action." Thus in case a SIGCHLD has been lost, we send a SIGCHLD to oneself in order to avoid zombies: https://savannah.gnu.org/bugs/?25089
-rw-r--r--src/utmp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utmp.c b/src/utmp.c
index bb56e2c..02a6ae2 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -582,6 +582,15 @@ struct win *wi;
addToUtmp(wi->w_tty, host, wi->w_ptyfd);
else
removeLineFromUtmp(wi->w_tty, wi->w_ptyfd);
+ /*
+ * As documented in libutempter: "During execution of the privileged
+ * process spawned by these functions, SIGCHLD signal handler will be
+ * temporarily set to the default action."
+ * Thus in case a SIGCHLD has been lost, we send a SIGCHLD to oneself
+ * in order to avoid zombies: https://savannah.gnu.org/bugs/?25089
+ */
+ kill(getpid(), SIGCHLD);
+
return 1; /* pray for success */
}
#endif