From b1d97ea44e8a4c56ffddb1b3f5d8950f10996c11 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 26 Mar 2011 15:37:19 +0000 Subject: [PATCH] =?UTF-8?q?temporary=20patch=20for=20Cygwin=20against=20cd?= =?UTF-8?q?=20breaking=20UNC=20pathnames=20from=20Chris=20=E2=80=9Cironhea?= =?UTF-8?q?d=E2=80=9D=20Sutcliffe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc.c b/misc.c index d6b0221..8713e3e 100644 --- a/misc.c +++ b/misc.c @@ -29,7 +29,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.158 2011/03/24 19:05:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.159 2011/03/26 15:37:19 tg Exp $"); /* type bits for unsigned char */ unsigned char chtypes[UCHAR_MAX + 1]; @@ -1368,8 +1368,9 @@ do_realpath(const char *upath) /* assert: (ip == ipath)[0] == '/' */ /* assert: xp == xs.beg => start of path */ + /* exactly two leading slashes? */ if (ip[1] == '/' && ip[2] != '/') { - /* keep UNC names, per POSIX */ + /* SUSv4 3.266 Pathname */ Xput(xs, xp, '/'); } } @@ -1526,6 +1527,9 @@ simplify_path(char *pathl) if ((isrooted = pathl[0] == '/')) very_start++; + /* exactly two leading slashes? (SUSv4 3.266) */ + if (isrooted && pathl[1] == '/' && pathl[2] != '/') + very_start++; /*- * Before After