summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Lefevre <vincent@vinc17.net>2022-02-17 03:08:26 +0200
committerAlexander Naumov <alexander_naumov@opensuse.org>2022-02-17 03:08:26 +0200
commitc56ab476b9cf41a46f823537dab0dab0c006d962 (patch)
tree0fccf8284af45cca6eaa5fd87a47607992b3a448
parent3aa385ea5279c77986ee2eece4289dce890612cb (diff)
downloadscreen-c56ab476b9cf41a46f823537dab0dab0c006d962.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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utmp.c b/src/utmp.c
index d4effeb..5377864 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -349,6 +349,16 @@ static int pututslot(slot_t slot, struct utmpx *u, char *host, Window *win)
utempter_add_record(win->w_ptyfd, host);
else
utempter_remove_record(win->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 */
}
#else