From e60beff86b453747c8eed485b571e43a3c26411e Mon Sep 17 00:00:00 2001 From: dsl Date: Sat, 26 Nov 2005 21:44:43 +0000 Subject: [PATCH] Don't change the name of the directory we are going to 'cd' to just because we decide to remove a leading "./" when deciding whether to print the name. Stops 'cd .//tmp' ending up the same as 'cd /tmp'. Fixes PR/30735 --- bin/sh/cd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/sh/cd.c b/bin/sh/cd.c index f94e7baea888..ae3938cab0bb 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.37 2005/10/10 21:14:42 christos Exp $ */ +/* $NetBSD: cd.c,v 1.38 2005/11/26 21:44:43 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)cd.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: cd.c,v 1.37 2005/10/10 21:14:42 christos Exp $"); +__RCSID("$NetBSD: cd.c,v 1.38 2005/11/26 21:44:43 dsl Exp $"); #endif #endif /* not lint */ @@ -131,8 +131,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) >= 0) return 0;