summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-12-03 06:21:40 +0000
committerChristopher Faylor <me@cgf.cx>2000-12-03 06:21:40 +0000
commit191bacb0be9c3f7949c9a16935bcb521f108e609 (patch)
tree9f2f9d0967042126bfa82c793f020429abb9e63f
parent92311ab5e551d245dc50a99723ff8cb949ea743e (diff)
downloadcygnal-191bacb0be9c3f7949c9a16935bcb521f108e609.tar.gz
cygnal-191bacb0be9c3f7949c9a16935bcb521f108e609.tar.bz2
cygnal-191bacb0be9c3f7949c9a16935bcb521f108e609.zip
* path.cc (normalize_win32_path): Handle UNC paths better.
(slash_unc_prefix_p): Allow backslash UNC paths.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/path.cc14
2 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 75729c584..d00c15284 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+Sun Dec 3 01:20:25 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (normalize_win32_path): Handle UNC paths better.
+ (slash_unc_prefix_p): Allow backslash UNC paths.
+
Sun Dec 3 00:20:25 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Remove some extra cruft.
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 8e392d772..b00b1ae8f 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -713,12 +713,20 @@ normalize_win32_path (const char *src, char *dst)
char *dst_start = dst;
char *dst_root_start = dst;
- if (strchr (src, ':') == NULL)
+ if (strchr (src, ':') == NULL && !slash_unc_prefix_p (src))
{
if (!cygcwd.get (dst, 0))
return get_errno ();
if (SLASH_P (src[0]))
- dst[2] = '\0';
+ if (dst[1] == ':')
+ dst[2] = '\0';
+ else if (slash_unc_prefix_p (dst))
+ {
+ char *p = strpbrk (dst + 2, "\\/");
+ if (p && (p = strpbrk (p + 1, "\\/")))
+ *p = '\0';
+ }
+
else if (strlen (dst) + 1 + strlen (src) >= MAX_PATH)
{
debug_printf ("ENAMETOOLONG = normalize_win32_path (%s)", src);
@@ -881,7 +889,7 @@ slash_unc_prefix_p (const char *path)
&& isalpha (path[2])
&& path[3] != 0
&& !isdirsep (path[3])
- && ((p = strchr(&path[3], '/')) != NULL));
+ && ((p = strpbrk(path + 3, "\\/")) != NULL));
if (!ret || p == NULL)
return ret;
return ret && isalnum (p[1]);