From 30a70fa2dab1925b0eaea04f67e3f86b360386dd Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 28 Mar 2022 15:54:03 +0200 Subject: sfeed_curses: ignore SIGCHLD only for non-interactive programs This is a regression from the introduced change. Else wait(&status) returned -1 and status was uninitialized. The status of the returned program in the markread() function is used to visually show it as read/unread. If the program failed it is assumed the program could not mark it and so it is visually unchanged. Just to be sure also initialize status to -1 (which can never happen normally) since the exitstatus range is 0-255. https://man.openbsd.org/wait#ERRORS [ECHILD]: "No status from the terminated child process is available because the calling process has asked the system to discard such status by ignoring the signal SIGCHLD or setting the flag SA_NOCLDWAIT for that signal." --- sfeed_curses.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sfeed_curses.c b/sfeed_curses.c index b5d1901..00189a0 100644 --- a/sfeed_curses.c +++ b/sfeed_curses.c @@ -558,9 +558,6 @@ init(void) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); sigaction(SIGWINCH, &sa, NULL); - /* ignore SIGCHLD: for non-interactive programs: don't become a zombie */ - sa.sa_handler = SIG_IGN; - sigaction(SIGCHLD, &sa, NULL); } void @@ -583,6 +580,10 @@ processexit(pid_t pid, int interactive) updatesidebar(); updategeom(); updatetitle(); + } else { + /* ignore SIGCHLD: for non-interactive programs: don't become a zombie */ + sa.sa_handler = SIG_IGN; + sigaction(SIGCHLD, &sa, NULL); } } @@ -1836,7 +1837,7 @@ markread(struct pane *p, off_t from, off_t to, int isread) FILE *fp; off_t i; const char *cmd; - int isnew = !isread, pid, wpid, status, visstart; + int isnew = !isread, pid, wpid, status = -1, visstart; if (!urlfile || !p->nrows) return; -- cgit v1.2.3