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

This commit is contained in:
sin 2014-01-27 15:15:58 +00:00
parent a0fbe3278a
commit 6a18e77962

View File

@ -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;
}