aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-08-05 18:04:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-08-05 18:11:15 +0200
commit2596f412cd02d4b040262e5f40de2e7a7e6b32cf (patch)
treea91540715f5eafb8a5265c5a748d5edae16c3974
parent1c5eb88cd84c90e4c3d014f4abc8f8310c008842 (diff)
downloadbusybox-w32-2596f412cd02d4b040262e5f40de2e7a7e6b32cf.tar.gz
busybox-w32-2596f412cd02d4b040262e5f40de2e7a7e6b32cf.tar.bz2
busybox-w32-2596f412cd02d4b040262e5f40de2e7a7e6b32cf.zip
ash: exec: Return 126 on most errors in shellexec
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@gondor.apana.org.au> function old new delta shellexec 245 254 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c8
1 files 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)
8098 8098
8099 /* Map to POSIX errors */ 8099 /* Map to POSIX errors */
8100 switch (e) { 8100 switch (e) {
8101 case EACCES: 8101 default:
8102 exerrno = 126; 8102 exerrno = 126;
8103 break; 8103 break;
8104 case ELOOP:
8105 case ENAMETOOLONG:
8104 case ENOENT: 8106 case ENOENT:
8107 case ENOTDIR:
8105 exerrno = 127; 8108 exerrno = 127;
8106 break; 8109 break;
8107 default:
8108 exerrno = 2;
8109 break;
8110 } 8110 }
8111 exitstatus = exerrno; 8111 exitstatus = exerrno;
8112 TRACE(("shellexec failed for %s, errno %d, suppress_int %d\n", 8112 TRACE(("shellexec failed for %s, errno %d, suppress_int %d\n",