summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2006-06-12 21:06:00 +0000
committerstefanf <stefanf@FreeBSD.org>2006-06-12 21:06:00 +0000
commitec7a44920791ea14b9eb51468503285eaf116c8a (patch)
tree3f636d37db26a5c85bf71c99f245a8302006ec6b /bin/sh
parent716b0c76f37c7a1919b09032b1b9e4002c92246a (diff)
downloadFreeBSD-src-ec7a44920791ea14b9eb51468503285eaf116c8a.zip
FreeBSD-src-ec7a44920791ea14b9eb51468503285eaf116c8a.tar.gz
Don't strip a leading ./ from the path for the cd builtin to avoid interpreting
.//dir as /dir. Rather strip it only for the purpose of checking if the directory path should be printed. PR: 88813 Submitted by: Josh Elsasser Patch from: NetBSD (cd.c rev 1.38) MFC after: 2 weeks
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/cd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c
index 24af3e1..d52c9b8 100644
--- a/bin/sh/cd.c
+++ b/bin/sh/cd.c
@@ -124,8 +124,9 @@ cdcmd(int argc, char **argv)
* XXX - rethink
*/
if (p[0] == '.' && p[1] == '/' && p[2] != '\0')
- p += 2;
- print = strcmp(p, dest);
+ print = strcmp(p + 2, dest);
+ else
+ print = strcmp(p, dest);
}
if (docd(p, print, phys) >= 0)
return 0;
OpenPOWER on IntegriCloud