commit 44b3ea8f762daa9b4f6bf13ebd58e2c3d1fc6e84
parent 2869adf45872d0271a50b018c81fbdef5f6b88c0
Author: sin <sin@2f30.org>
Date: Thu, 13 Nov 2014 17:06:18 +0000
Use _exit() instead of return if exec* fails
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/nohup.c b/nohup.c
@@ -33,7 +33,7 @@ main(int argc, char *argv[])
if(isatty(STDOUT_FILENO)) {
if((fd = open("nohup.out", O_APPEND|O_CREAT,
- S_IRUSR|S_IWUSR)) == -1) {
+ S_IRUSR|S_IWUSR)) == -1) {
enprintf(Error, "open nohup.out:");
}
if(dup2(fd, STDOUT_FILENO) == -1)
@@ -46,6 +46,5 @@ main(int argc, char *argv[])
execvp(argv[0], &argv[0]);
enprintf(errno == ENOENT ? Error : Found, "exec %s:", argv[0]);
-
- return Error;
+ _exit(Error);
}