sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 6a18e77962eee34480e7b8c89f1e4a441beac8bf
parent a0fbe3278a567c158ce225d5c1d41e357b2b845b
Author: sin <sin@2f30.org>
Date:   Mon, 27 Jan 2014 15:15:58 +0000

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

Diffstat:
Msetsid.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/setsid.c b/setsid.c @@ -15,6 +15,8 @@ usage(void) int main(int argc, char *argv[]) { + int savederrno; + ARGBEGIN { default: usage(); @@ -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; }