commit e2eb0771342a2c7de70746fba612e44b5d85a098
parent 2a2a2b48c83d17638e2b15d61eb5be126923ddd4
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date: Wed, 5 Feb 2020 07:45:47 +0100
fix exit code handling
scroll should transparently forward the exit status of the child
process to its caller.
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scroll.c b/scroll.c
@@ -82,7 +82,7 @@ sigchld(int sig)
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
if (pid == child)
- exit(status);
+ exit(WEXITSTATUS(status));
}
void
@@ -255,8 +255,6 @@ main(int argc, char *argv[])
ssize_t n = read(mfd, &c, 1);
if (n == -1 && errno != EINTR)
die("read:");
- if (n == 0)
- return 0;
buf[pos++] = c;
if (pos == size) {
size *= 2;