diff options
-rw-r--r-- | shell/ash.c | 32 | ||||
-rw-r--r-- | shell/ash_test/ash-redir/redir_exec1.right | 1 |
2 files changed, 16 insertions, 17 deletions
diff --git a/shell/ash.c b/shell/ash.c index 145896229..5570057e9 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10253,6 +10253,17 @@ evalcommand(union node *cmd, int flags) | |||
10253 | } | 10253 | } |
10254 | status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH | REDIR_SAVEFD2); | 10254 | status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH | REDIR_SAVEFD2); |
10255 | 10255 | ||
10256 | if (status) { | ||
10257 | bail: | ||
10258 | exitstatus = status; | ||
10259 | |||
10260 | /* We have a redirection error. */ | ||
10261 | if (spclbltin > 0) | ||
10262 | raise_exception(EXERROR); | ||
10263 | |||
10264 | goto out; | ||
10265 | } | ||
10266 | |||
10256 | for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) { | 10267 | for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) { |
10257 | struct strlist **spp; | 10268 | struct strlist **spp; |
10258 | 10269 | ||
@@ -10304,28 +10315,17 @@ evalcommand(union node *cmd, int flags) | |||
10304 | ) { | 10315 | ) { |
10305 | find_command(argv[0], &cmdentry, cmd_flag | DO_ERR, | 10316 | find_command(argv[0], &cmdentry, cmd_flag | DO_ERR, |
10306 | path ? path : pathval()); | 10317 | path ? path : pathval()); |
10307 | if (cmdentry.cmdtype == CMDUNKNOWN) { | ||
10308 | status = 127; | ||
10309 | flush_stdout_stderr(); | ||
10310 | goto bail; | ||
10311 | } | ||
10312 | } | ||
10313 | |||
10314 | if (status) { | ||
10315 | bail: | ||
10316 | exitstatus = status; | ||
10317 | |||
10318 | /* We have a redirection error. */ | ||
10319 | if (spclbltin > 0) | ||
10320 | raise_exception(EXERROR); | ||
10321 | |||
10322 | goto out; | ||
10323 | } | 10318 | } |
10324 | 10319 | ||
10325 | jp = NULL; | 10320 | jp = NULL; |
10326 | 10321 | ||
10327 | /* Execute the command. */ | 10322 | /* Execute the command. */ |
10328 | switch (cmdentry.cmdtype) { | 10323 | switch (cmdentry.cmdtype) { |
10324 | case CMDUNKNOWN: | ||
10325 | status = 127; | ||
10326 | flush_stdout_stderr(); | ||
10327 | goto bail; | ||
10328 | |||
10329 | default: { | 10329 | default: { |
10330 | 10330 | ||
10331 | #if ENABLE_FEATURE_SH_STANDALONE \ | 10331 | #if ENABLE_FEATURE_SH_STANDALONE \ |
diff --git a/shell/ash_test/ash-redir/redir_exec1.right b/shell/ash_test/ash-redir/redir_exec1.right index c98455bf5..26a664edc 100644 --- a/shell/ash_test/ash-redir/redir_exec1.right +++ b/shell/ash_test/ash-redir/redir_exec1.right | |||
@@ -1,2 +1 @@ | |||
1 | ./redir_exec1.tests: line 1: can't create /cant/be/created: nonexistent directory | ./redir_exec1.tests: line 1: can't create /cant/be/created: nonexistent directory | |
2 | First | ||