sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit f4c4b97bba99c7848bf3cda287564db8219b0f40
parent 3eb3533fae6c43907adbd340b24bee79f709504e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  2 Apr 2022 00:33:29 +0200

sfeed_curses: line editor: handle SIGCHLD directly

This makes sure when processes exit they are reaped immediately (instead of
after closing the line editor).

Diffstat:
Msfeed_curses.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sfeed_curses.c b/sfeed_curses.c @@ -1006,12 +1006,19 @@ lineeditor(void) ttywrite(&input[nchars]); nchars++; } else if (ch < 0) { + if (state_sigchld) { + state_sigchld = 0; + /* wait on child processes so they don't become a zombie */ + while (waitpid((pid_t)-1, NULL, WNOHANG) > 0) + ; + } if (state_sigint) - state_sigint = 0; /* reset: do not handle it later */ + state_sigint = 0; /* cancel prompt and don't handle this signal */ else if (state_sighup || state_sigterm) ; /* cancel prompt and handle these signals */ else /* no signal, time-out or SIGCHLD or SIGWINCH */ continue; /* do not cancel: process signal later */ + free(input); input = NULL; break; /* cancel prompt */