temporary patch for Cygwin against cd breaking UNC pathnames

from Chris “ironhead” Sutcliffe
This commit is contained in:
tg 2011-03-26 15:37:19 +00:00
parent 2dffc771ac
commit b1d97ea44e

8
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h> #include <grp.h>
#endif #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 */ /* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1]; unsigned char chtypes[UCHAR_MAX + 1];
@ -1368,8 +1368,9 @@ do_realpath(const char *upath)
/* assert: (ip == ipath)[0] == '/' */ /* assert: (ip == ipath)[0] == '/' */
/* assert: xp == xs.beg => start of path */ /* assert: xp == xs.beg => start of path */
/* exactly two leading slashes? */
if (ip[1] == '/' && ip[2] != '/') { if (ip[1] == '/' && ip[2] != '/') {
/* keep UNC names, per POSIX */ /* SUSv4 3.266 Pathname */
Xput(xs, xp, '/'); Xput(xs, xp, '/');
} }
} }
@ -1526,6 +1527,9 @@ simplify_path(char *pathl)
if ((isrooted = pathl[0] == '/')) if ((isrooted = pathl[0] == '/'))
very_start++; very_start++;
/* exactly two leading slashes? (SUSv4 3.266) */
if (isrooted && pathl[1] == '/' && pathl[2] != '/')
very_start++;
/*- /*-
* Before After * Before After