diff options
author | Denys Vlasenko | 2016-10-03 01:01:15 +0200 |
---|---|---|
committer | Denys Vlasenko | 2016-10-03 01:01:15 +0200 |
commit | 04465dad66478aea28100ff5b9094d1c02336f07 (patch) | |
tree | 27128fa073ac143b531eb6086d6099afd9730df9 /shell | |
parent | c775f829db2e25ffa384ffe1b6b6859cdddfa935 (diff) | |
download | busybox-04465dad66478aea28100ff5b9094d1c02336f07.zip busybox-04465dad66478aea28100ff5b9094d1c02336f07.tar.gz |
hush: fix exitcode on exec failure with EACCES - should be 126
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index f1d25a1..d0d9830 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -6735,13 +6735,17 @@ static void exec_builtin(char ***to_free, static void execvp_or_die(char **argv) NORETURN; static void execvp_or_die(char **argv) { + int e; debug_printf_exec("execing '%s'\n", argv[0]); /* Don't propagate SIG_IGN to the child */ if (SPECIAL_JOBSTOP_SIGS != 0) switch_off_special_sigs(G.special_sig_mask & SPECIAL_JOBSTOP_SIGS); execvp(argv[0], argv); + e = 2; + if (errno == EACCES) e = 126; + if (errno == ENOENT) e = 127; bb_perror_msg("can't execute '%s'", argv[0]); - _exit(127); /* bash compat */ + _exit(e); } #if ENABLE_HUSH_MODE_X |