mirror of
git://git.suckless.org/sbase
synced 2025-01-03 13:42:03 +00:00
Ensure we return a proper error value in setsid(1)
This commit is contained in:
parent
a0fbe3278a
commit
6a18e77962
7
setsid.c
7
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user