Don't trash the logical $PWD if a component is a symlink; no other shell

does this.
This commit is contained in:
christos 2016-12-26 02:27:57 +00:00
parent aeb848823f
commit 56b5e39636
1 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.46 2016/05/02 01:46:31 christos Exp $ */
/* $NetBSD: cd.c,v 1.47 2016/12/26 02:27:57 christos 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.46 2016/05/02 01:46:31 christos Exp $");
__RCSID("$NetBSD: cd.c,v 1.47 2016/12/26 02:27:57 christos Exp $");
#endif
#endif /* not lint */
@ -190,9 +190,7 @@ docd(const char *dest, int print)
if (equal(component, ".."))
continue;
STACKSTRNUL(p);
if ((lstat(stackblock(), &statb) < 0)
|| (S_ISLNK(statb.st_mode))) {
/* print = 1; */
if (lstat(stackblock(), &statb) < 0) {
badstat = 1;
break;
}