aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-08-01 09:02:23 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-08-03 13:36:09 +0900
commit8b502d863500149f4e86497714f0462e788f2f1e (patch)
tree465817c48cfcb7027d7fda64f64e6baea095b3c5
parentbfee9c6ab0c3c9a5742e84509d01ec6472aa62c4 (diff)
downloadnewlib-8b502d863500149f4e86497714f0462e788f2f1e.zip
newlib-8b502d863500149f4e86497714f0462e788f2f1e.tar.gz
newlib-8b502d863500149f4e86497714f0462e788f2f1e.tar.bz2
Cygwin: path: Make some symlinks to /cygdrive/* work.
- Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C, /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html
-rw-r--r--winsup/cygwin/path.cc6
-rw-r--r--winsup/cygwin/release/3.3.64
2 files changed, 9 insertions, 1 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index ea695ed..b159b56 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1929,7 +1929,11 @@ symlink_wsl (const char *oldpath, path_conv &win32_newpath)
cygdrive prefix is not "/", otherwise suffer random "/mnt" symlinks... */
if (mount_table->cygdrive_len > 1
&& path_prefix_p (mount_table->cygdrive, oldpath,
- mount_table->cygdrive_len, false))
+ mount_table->cygdrive_len, false)
+ && (strlen (oldpath + mount_table->cygdrive_len - 1) < 2
+ || (islower (oldpath[mount_table->cygdrive_len])
+ && (oldpath[mount_table->cygdrive_len + 1] == '/'
+ || oldpath[mount_table->cygdrive_len + 1] == '\0'))))
stpcpy (stpcpy (path_buf, "/mnt"),
oldpath + mount_table->cygdrive_len - 1);
else
diff --git a/winsup/cygwin/release/3.3.6 b/winsup/cygwin/release/3.3.6
index 5fb59bf..078e6e5 100644
--- a/winsup/cygwin/release/3.3.6
+++ b/winsup/cygwin/release/3.3.6
@@ -31,3 +31,7 @@ Bug Fixes
native apps if *.bat or *.cmd is executed directly from cygwin
shell.
Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251993.html
+
+- Fix a problem that prevented some symbolic links to /cygdrive/C,
+ /cygdrive/./c, /cygdrive//c, etc. from working.
+ Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html