commit b2264d5892343e61594d703330b85c33172ce00a
parent 33ae34357f371f45ecb5f988bcdd961372130565
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 27 Mar 2022 12:40:07 +0200
sfeed_curses: processexit: do not set and reset SIGINT for non-interactive plumbing
Only set/override it in the interactive case.
Also add some comments.
No functional change intended.
Diffstat:
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -569,22 +569,20 @@ processexit(pid_t pid, int interactive)
pid_t wpid;
struct sigaction sa;
- memset(&sa, 0, sizeof(sa));
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_RESTART; /* require BSD signal semantics */
- sa.sa_handler = SIG_IGN;
- sigaction(SIGINT, &sa, NULL);
-
if (interactive) {
+ /* ignore SIGINT (^C) in parent in interactive applications */
+ memset(&sa, 0, sizeof(sa));
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART; /* require BSD signal semantics */
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGINT, &sa, NULL);
+ /* wait for process to change state */
while ((wpid = wait(NULL)) >= 0 && wpid != pid)
;
init();
updatesidebar();
updategeom();
updatetitle();
- } else {
- sa.sa_handler = sighandler;
- sigaction(SIGINT, &sa, NULL);
}
}