From 69e741477c3292596abfa44f26ac78901c512903 Mon Sep 17 00:00:00 2001 From: stefanf Date: Thu, 11 Jan 2007 00:19:00 +0000 Subject: Return an error status (127) from the builtins 'type' and 'command' (with either -v or -V) if a file with a slash in the name doesn't exist (if there is no slash we already did that). Additionally, suppress the error message for command -v for files with a slash. PR: 107674 Submitted by: Martin Kammerhofer --- bin/sh/exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/sh') diff --git a/bin/sh/exec.c b/bin/sh/exec.c index 85794d9..b9d7838 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -785,9 +785,12 @@ typecmd_impl(int argc, char **argv, int cmd) out1fmt("%s\n", argv[i]); else out1fmt(" is %s\n", argv[i]); + } else { + if (cmd != TYPECMD_SMALLV) + out1fmt(": %s\n", + strerror(errno)); + error |= 127; } - else - out1fmt(": %s\n", strerror(errno)); } break; } -- cgit v1.1