summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-01 11:48:18 +0000
committertjr <tjr@FreeBSD.org>2002-10-01 11:48:18 +0000
commit2b33063d0129e681bab01e87ef4c16c7c964a401 (patch)
tree9e6cb9cbac3e6a408353de462840c8f1886fe8c1 /bin/sh
parentbad1a9d8524b93e5cd5e0cb4fc49fbe8fae5460d (diff)
downloadFreeBSD-src-2b33063d0129e681bab01e87ef4c16c7c964a401.zip
FreeBSD-src-2b33063d0129e681bab01e87ef4c16c7c964a401.tar.gz
Restore "not found" error message when searching for (or executing)
a program fails because the file or a path component does not exist. Suggested by: bde
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/exec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index d70d03e..21f247f 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -144,6 +144,8 @@ shellexec(char **argv, char **envp, char *path, int index)
exerrno = 2;
break;
}
+ if (e == ENOENT || e == ENOTDIR)
+ exerror(EXEXEC, "%s: not found", argv[0]);
exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
}
@@ -419,8 +421,12 @@ loop:
/* We failed. If there was an entry for this command, delete it */
if (cmdp)
delete_cmd_entry();
- if (printerr)
- outfmt(out2, "%s: %s\n", name, strerror(e));
+ if (printerr) {
+ if (e == ENOENT || e == ENOTDIR)
+ outfmt(out2, "%s: not found\n", name);
+ else
+ outfmt(out2, "%s: %s\n", name, strerror(e));
+ }
entry->cmdtype = CMDUNKNOWN;
return;
OpenPOWER on IntegriCloud