diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-07-10 08:44:29 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-11-16 19:34:57 -0800 |
commit | f29fa1383145a57751aefff11699cc76138fb01a (patch) | |
tree | 5c46b9b7aea206c306d666c528d157eda7a822af /winsup | |
parent | 57dc57420958d5cb43df011c20eef44adb7506d2 (diff) | |
download | cygnal-f29fa1383145a57751aefff11699cc76138fb01a.tar.gz cygnal-f29fa1383145a57751aefff11699cc76138fb01a.tar.bz2 cygnal-f29fa1383145a57751aefff11699cc76138fb01a.zip |
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.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/mount.cc | 75 |
1 files changed, 1 insertions, 74 deletions
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 2fe9c835a..af3894cb9 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -920,80 +920,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; } |