sh: Return only 126 or 127 for execve() failures.
Do not return 2 for errors other than [EACCES] or [ENOENT].
This commit is contained in:
parent
252f7f93b0
commit
834d160b3a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218242
@ -129,21 +129,14 @@ shellexec(char **argv, char **envp, const char *path, int idx)
|
||||
}
|
||||
|
||||
/* Map to POSIX errors */
|
||||
switch (e) {
|
||||
case EACCES:
|
||||
exerrno = 126;
|
||||
break;
|
||||
case ENOENT:
|
||||
if (e == ENOENT || e == ENOTDIR) {
|
||||
exerrno = 127;
|
||||
break;
|
||||
default:
|
||||
exerrno = 2;
|
||||
break;
|
||||
}
|
||||
if (e == ENOENT || e == ENOTDIR)
|
||||
exerror(EXEXEC, "%s: not found", argv[0]);
|
||||
} else {
|
||||
exerrno = 126;
|
||||
exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user