From b2264d5892343e61594d703330b85c33172ce00a Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 27 Mar 2022 12:40:07 +0200 Subject: 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. --- sfeed_curses.c | 16 +++++++--------- 1 file 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); } } -- cgit v1.2.3