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
This commit is contained in:
stefanf 2006-06-12 21:06:00 +00:00
parent 716b0c76f3
commit ec7a449207

View File

@ -124,7 +124,8 @@ cdcmd(int argc, char **argv)
* XXX - rethink
*/
if (p[0] == '.' && p[1] == '/' && p[2] != '\0')
p += 2;
print = strcmp(p + 2, dest);
else
print = strcmp(p, dest);
}
if (docd(p, print, phys) >= 0)