From 2b33063d0129e681bab01e87ef4c16c7c964a401 Mon Sep 17 00:00:00 2001 From: tjr Date: Tue, 1 Oct 2002 11:48:18 +0000 Subject: 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 --- bin/sh/exec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bin/sh') 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; -- cgit v1.1