commit 27f1d92dfaccfc844655c7872fe3a990ed77d1e2
parent 31f6b1905e43b01fd4941d29fd0c6f0eae2be850
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 28 Jun 2020 15:30:42 +0200
call _exit(2) for child process which is safer than exit(3)
As mentioned in the OpenBSD fork(2) man page:
"In general, the child process should call _exit(2) rather than exit(3).
Otherwise, any stdio buffers that exist both in the parent and child will be
flushed twice. Similarly, _exit(2) should be used to prevent atexit(3)
routines from being called twice (once in the parent and once in the child)."
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -445,7 +445,7 @@ pipeitem(const char *cmd, struct item *item)
fputs(item->fields[i], fp);
}
fputc('\n', fp);
- exit(pclose(fp));
+ _exit(pclose(fp));
break;
default:
while ((wpid = wait(NULL)) >= 0 && wpid != pid)