According to POSIX, exit status must be 127 if the requested utility was not

found, 126 if the execvp() failed for any other reason.

Similar to rev. 1.6 to src/usr.bin/env/env.c

Reviewed by:	mike
This commit is contained in:
Tim J. Robbins 2002-05-10 06:39:16 +00:00
parent fafc736254
commit c17fd4b5cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96335
2 changed files with 15 additions and 5 deletions

View File

@ -72,10 +72,6 @@ super-user.
Negative numbers are expressed as
.Fl - Ns Ar number .
.Pp
The returned exit status is the exit value from the
command executed by
.Nm .
.Pp
Some shells may provide a builtin
.Nm
command which is similar or identical to this utility.
@ -96,6 +92,20 @@ Execute command
.Sq date
at priority -19 assuming the priority of the
shell is 0 and you are the super-user.
.Sh DIAGNOSTICS
If
.Ar command
is invoked, the exit status of
.Nm
is the exit status of
.Ar command .
.Pp
An exit status of 126 indicates
.Ar command
was found, but could not be executed.
An exit status of 127 indicates
.Ar command
could not be found.
.Sh SEE ALSO
.Xr builtin 1 ,
.Xr csh 1 ,

View File

@ -90,7 +90,7 @@ main(argc, argv)
if (setpriority(PRIO_PROCESS, 0, niceness))
err(1, "setpriority");
execvp(argv[1], &argv[1]);
err(1, "%s", argv[1]);
err(errno == ENOENT ? 127 : 126, "%s", argv[1]);
}
void