[hackers] [sbase] Ensure we return a proper error value in setsid(1) || sin

From: <git_AT_suckless.org>
Date: Mon, 27 Jan 2014 16:18:37 +0100

commit 6a18e77962eee34480e7b8c89f1e4a441beac8bf
Author: sin <sin_AT_2f30.org>
Date: Mon Jan 27 15:15:58 2014 +0000

    Ensure we return a proper error value in setsid(1)

diff --git a/setsid.c b/setsid.c
index 6f7c095..b46c4f3 100644
--- a/setsid.c
+++ b/setsid.c
_AT_@ -15,6 +15,8 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
+ int savederrno;
+
         ARGBEGIN {
         default:
                 usage();
_AT_@ -36,6 +38,7 @@ main(int argc, char *argv[])
         if(setsid() < 0)
                 eprintf("setsid:");
         execvp(argv[0], argv);
- eprintf("execvp:");
- return (errno == ENOENT) ? 127 : 126;
+ savederrno = errno;
+ weprintf("execvp %s:", argv[0]);
+ return (savederrno == ENOENT) ? 127 : 126;
 }
Received on Mon Jan 27 2014 - 16:18:37 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 27 2014 - 16:24:08 CET