From 44b3ea8f762daa9b4f6bf13ebd58e2c3d1fc6e84 Mon Sep 17 00:00:00 2001 From: sin Date: Thu, 13 Nov 2014 17:06:18 +0000 Subject: [PATCH] Use _exit() instead of return if exec* fails --- nohup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nohup.c b/nohup.c index 6ac9d2b..f1da290 100644 --- 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); }