svn commit: r218242 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Thu Feb 3 23:38:11 UTC 2011
Author: jilles
Date: Thu Feb 3 23:38:11 2011
New Revision: 218242
URL: http://svn.freebsd.org/changeset/base/218242
Log:
sh: Return only 126 or 127 for execve() failures.
Do not return 2 for errors other than [EACCES] or [ENOENT].
Modified:
head/bin/sh/exec.c
Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c Thu Feb 3 20:44:49 2011 (r218241)
+++ head/bin/sh/exec.c Thu Feb 3 23:38:11 2011 (r218242)
@@ -129,20 +129,13 @@ shellexec(char **argv, char **envp, cons
}
/* 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]);
- exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+ } else {
+ exerrno = 126;
+ exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+ }
}
More information about the svn-src-all
mailing list