summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2007-01-11 00:19:00 +0000
committerstefanf <stefanf@FreeBSD.org>2007-01-11 00:19:00 +0000
commit69e741477c3292596abfa44f26ac78901c512903 (patch)
treedecc832cfad798c4d6084f9efbcb074ea29d11c0
parent4385f99f9384fa974e8848520daf243ffc7c27d7 (diff)
downloadFreeBSD-src-69e741477c3292596abfa44f26ac78901c512903.zip
FreeBSD-src-69e741477c3292596abfa44f26ac78901c512903.tar.gz
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
-rw-r--r--bin/sh/exec.c7
1 files changed, 5 insertions, 2 deletions
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;
}
OpenPOWER on IntegriCloud