Determine exit status to use before writing diagnostic message; warn()
may change errno.
This commit is contained in:
parent
816dde7d05
commit
d6c762af40
@ -122,13 +122,8 @@ main(argc, argv)
|
||||
err(1, "time");
|
||||
/* NOTREACHED */
|
||||
case 0: /* child */
|
||||
errno = 0;
|
||||
execvp(*argv, argv);
|
||||
warn("%s", *argv);
|
||||
if (errno == ENOENT)
|
||||
_exit(127); /* POSIX: utility could not be found */
|
||||
else
|
||||
_exit(126); /* POSIX: utility could not be invoked */
|
||||
err(errno == ENOENT ? 127 : 126, "%s", *argv);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
/* parent */
|
||||
|
Loading…
Reference in New Issue
Block a user