externalpipe: ensure all of st's children are reaped

This commit is contained in:
bakkeby 2020-08-21 17:28:14 +02:00
parent 315c5cbe9f
commit 8faa9f3c93
1 changed files with 11 additions and 0 deletions

11
st.c
View File

@ -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);