diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2022-03-28 15:54:03 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2022-03-28 15:58:00 +0200 |
commit | 30a70fa2dab1925b0eaea04f67e3f86b360386dd (patch) | |
tree | f47ac9b996ba2ad2645aa00fcac307d683d9dcb7 | |
parent | df2250aa196b674c0783d3ba1862b1cfb5df5719 (diff) |
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."
-rw-r--r-- | sfeed_curses.c | 9 |
1 files 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; |