summaryrefslogtreecommitdiffstats
path: root/bin/sh/exec.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-10-06 22:00:14 +0000
committerjilles <jilles@FreeBSD.org>2009-10-06 22:00:14 +0000
commitfab15b104fd8b8032114bca20d5768c8af19156d (patch)
tree1f4527ca00ce718b312864a2fb301567490f5fa0 /bin/sh/exec.c
parent3665e257c1063729cb55852b1e0686ab8301f7d1 (diff)
downloadFreeBSD-src-fab15b104fd8b8032114bca20d5768c8af19156d.zip
FreeBSD-src-fab15b104fd8b8032114bca20d5768c8af19156d.tar.gz
sh: Send the "xyz: not found" message to redirected fd 2.
This also fixes that trying to execute a non-regular file with a command name without '/' returns 127 instead of 126. The fix is rather simplistic: treat CMDUNKNOWN as if the command were found as an external program. The resulting fork is a bit wasteful but executing unknown commands should not be very frequent. PR: bin/137659
Diffstat (limited to 'bin/sh/exec.c')
-rw-r--r--bin/sh/exec.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 8107821..f9d3c22 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -429,6 +429,7 @@ loop:
outfmt(out2, "%s: %s\n", name, strerror(e));
}
entry->cmdtype = CMDUNKNOWN;
+ entry->u.index = 0;
return;
success:
OpenPOWER on IntegriCloud