[git commit] ash: exec: Return 126 on most errors in shellexec
Denys Vlasenko
vda.linux at googlemail.com
Sun Aug 5 16:11:15 UTC 2018
commit: https://git.busybox.net/busybox/commit/?id=2596f412cd02d4b040262e5f40de2e7a7e6b32cf
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Upstream commit:
Date: Sat, 19 May 2018 02:39:37 +0800
exec: Return 126 on most errors in shellexec
Currently when shellexec fails on most errors the shell will exit
with exit status 2. This patch changes it to 126 in order to avoid
ambiguities with the exit status from a successful exec.
The errors that result in 127 has also been expanded to include
ENOTDIR, ENAMETOOLONG and ELOOP.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
function old new delta
shellexec 245 254 +9
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
shell/ash.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index 79ade5df4..ad50537a1 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8098,15 +8098,15 @@ static void shellexec(char *prog, char **argv, const char *path, int idx)
/* Map to POSIX errors */
switch (e) {
- case EACCES:
+ default:
exerrno = 126;
break;
+ case ELOOP:
+ case ENAMETOOLONG:
case ENOENT:
+ case ENOTDIR:
exerrno = 127;
break;
- default:
- exerrno = 2;
- break;
}
exitstatus = exerrno;
TRACE(("shellexec failed for %s, errno %d, suppress_int %d\n",
More information about the busybox-cvs
mailing list