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
This commit is contained in:
parent
0c1661b754
commit
8c39572997
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104283
@ -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 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
/* 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user