diff options
author | Sheldon Hearn <sheldonh@FreeBSD.org> | 1999-12-28 09:34:57 +0000 |
---|---|---|
committer | Sheldon Hearn <sheldonh@FreeBSD.org> | 1999-12-28 09:34:57 +0000 |
commit | 9abf30435bf2380a875180dd87b8e7b23aaff9bf (patch) | |
tree | 54a150c987e6c3cb4d1ee3b38ee24ddee8b45d5f /bin | |
parent | 920eb79f5511ac114d5d133f6c9ff8f7ef52f47c (diff) | |
download | src-9abf30435bf2380a875180dd87b8e7b23aaff9bf.tar.gz src-9abf30435bf2380a875180dd87b8e7b23aaff9bf.zip |
Take into account the fact that "[" may be called with a path,
for example "/bin/[".
Reported by: Vlad Skvortsov <vss@ulstu.ru>
Reported by: Peter Jeremy <peter.jeremy@alcatel.com.au>
Message-Id: 99Dec27.111307est.40321@border.alcanet.com.au
Notes
Notes:
svn path=/head/; revision=55179
Diffstat (limited to 'bin')
-rw-r--r-- | bin/test/test.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/test/test.c b/bin/test/test.c index e02559d3df72..c9df4e3cb758 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -163,8 +163,13 @@ main(argc, argv) char **argv; { int res; + char *p; - if (strcmp(argv[0], "[") == 0) { + if ((p = rindex(argv[0], '/')) == NULL) + p = argv[0]; + else + p++; + if (strcmp(p, "[") == 0) { if (strcmp(argv[--argc], "]")) errx(2, "missing ]"); argv[argc] = NULL; |