commit 8faa9f3c93cf2de93e03f0214baab15c3d7192cf
parent 315c5cbe9f6391069bfdfc473597c003922c341d
Author: bakkeby <bakkeby@gmail.com>
Date: Fri, 21 Aug 2020 17:28:14 +0200
externalpipe: ensure all of st's children are reaped
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/st.c b/st.c
@@ -789,8 +789,19 @@ sigchld(int a)
#endif // EXTERNALPIPEIN_PATCH
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
+ #if EXTERNALPIPE_PATCH
+ if (pid != p) {
+ if (p == 0 && wait(&stat) < 0)
+ die("wait: %s\n", strerror(errno));
+
+ /* reinstall sigchld handler */
+ signal(SIGCHLD, sigchld);
+ return;
+ }
+ #else
if (pid != p)
return;
+ #endif // EXTERNALPIPE_PATCH
#if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH
close(csdfd);