summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-03-27 12:40:07 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-03-27 12:40:07 +0200
commitb2264d5892343e61594d703330b85c33172ce00a (patch)
treec66bf7c5fd67c789fec68684255d9006015e7cd3
parent33ae34357f371f45ecb5f988bcdd961372130565 (diff)
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.
-rw-r--r--sfeed_curses.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sfeed_curses.c b/sfeed_curses.c
index 6f151d4..86a6f11 100644
--- 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);
}
}