From 18bf3105812dfe4a3b3982838175ec9a60372198 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 10 Jul 2016 08:44:29 -0700 Subject: Remove conversion of native paths to POSIX mount points. We don't want the behavior in Cygnal whereby a native path like C:\path\to\app is converted to /app in getcwd and other situations, or C:\random\path is converted to /cygdrive/c/random/path. * winsup/cygwin/mount.cc (mount_info::conv_to_posix_path): Remove entire section of code which scans mount points, mapping native paths to their mount points paths. All we do is "slashify" and exit. --- winsup/cygwin/mount.cc | 75 +------------------------------------------------- 1 file changed, 1 insertion(+), 74 deletions(-) diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 1e424bd23..c904a4462 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -907,80 +907,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, return rc; } - int pathbuflen = tail - pathbuf; - for (int i = 0; i < nmounts; ++i) - { - mount_item &mi = mount[native_sorted[i]]; - if (!path_prefix_p (mi.native_path, pathbuf, mi.native_pathlen, - mi.flags & MOUNT_NOPOSIX)) - continue; - - if (cygheap->root.exists () && !cygheap->root.posix_ok (mi.posix_path)) - continue; - - /* SRC_PATH is in the mount table. */ - int nextchar; - const char *p = pathbuf + mi.native_pathlen; - - if (!*p || !p[1]) - nextchar = 0; - else if (isdirsep (*p)) - nextchar = -1; - else - nextchar = 1; - - int addslash = nextchar > 0 ? 1 : 0; - if ((mi.posix_pathlen + (pathbuflen - mi.native_pathlen) + addslash) >= NT_MAX_PATH) - return ENAMETOOLONG; - strcpy (posix_path, mi.posix_path); - if (addslash || (!nextchar && append_slash)) - strcat (posix_path, "/"); - if (nextchar) - slashify (p, - posix_path + addslash + (mi.posix_pathlen == 1 - ? 0 : mi.posix_pathlen), - append_slash); - - if (cygheap->root.exists ()) - { - const char *p = cygheap->root.unchroot (posix_path); - memmove (posix_path, p, strlen (p) + 1); - } - goto out; - } - - if (!cygheap->root.exists ()) - /* nothing */; - else if (!cygheap->root.ischroot_native (pathbuf)) - return ENOENT; - else - { - const char *p = pathbuf + cygheap->root.native_length (); - if (*p) - slashify (p, posix_path, append_slash); - else - { - posix_path[0] = '/'; - posix_path[1] = '\0'; - } - goto out; - } - - /* Not in the database. This should [theoretically] only happen if either - the path begins with //, or / isn't mounted, or the path has a drive - letter not covered by the mount table. If it's a relative path then the - caller must want an absolute path (otherwise we would have returned - above). So we always return an absolute path at this point. */ - if (isdrive (pathbuf)) - cygdrive_posix_path (pathbuf, posix_path, append_slash | ccp_flags); - else - { - /* The use of src_path and not pathbuf here is intentional. - We couldn't translate the path, so just ensure no \'s are present. */ - slashify (src_path, posix_path, append_slash); - } - -out: + slashify (pathbuf, posix_path, 0); debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path); return 0; } -- cgit v1.2.3