commit ac033652fe384da13cfae1b3791c1488c4a59f8c
parent bf17657544109faf6a55cdaeae47c3a84022cdaf
Author: sin <sin@2f30.org>
Date: Mon, 7 Oct 2013 16:37:23 +0100
Do not return 0 on error for setsid(1)
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setsid.c b/setsid.c
@@ -1,5 +1,6 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details. */
+#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -37,6 +38,5 @@ main(int argc, char *argv[])
eprintf("setsid:");
execvp(argv[0], argv);
eprintf("execvp:");
- /* NOTREACHED */
- return 0;
+ return (errno == ENOENT) ? 127 : 126;
}