commit 066a0306a1e6b4bc92dac585fbf340db3ee92cb5
parent 82bebf8ce7a0f59e9d99c2b721f8b17b945a4aaa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 10 Mar 2015 20:05:18 +0100
fork: no need to _exit() on the error case
Diffstat:
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/setsid.c b/setsid.c
@@ -26,8 +26,7 @@ main(int argc, char *argv[])
if (getpgrp() == getpid()) {
switch (fork()) {
case -1:
- weprintf("fork:");
- _exit(1);
+ eprintf("fork:");
case 0:
break;
default:
diff --git a/tar.c b/tar.c
@@ -54,8 +54,7 @@ decomp(FILE *fp)
switch (fork()) {
case -1:
- weprintf("fork:");
- _exit(1);
+ eprintf("fork:");
case 0:
dup2(fileno(fp), 0);
dup2(fds[1], 1);
diff --git a/time.c b/time.c
@@ -41,8 +41,7 @@ main(int argc, char *argv[])
switch ((pid = fork())) {
case -1:
- weprintf("fork:");
- _exit(1);
+ eprintf("fork:");
case 0:
execvp(argv[0], argv);
savederrno = errno;
diff --git a/xargs.c b/xargs.c
@@ -168,8 +168,7 @@ spawn(void)
switch (fork()) {
case -1:
- weprintf("fork:");
- _exit(1);
+ eprintf("fork:");
case 0:
execvp(*cmd, cmd);
savederrno = errno;