Determine exit status to use before writing diagnostic message; warn()

may change errno.
This commit is contained in:
Tim J. Robbins 2002-05-25 03:32:23 +00:00
parent 816dde7d05
commit d6c762af40
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97268

View File

@ -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 */