This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] Don't generate Windows native symlinks targeting Cygwin-only targets
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 18 Nov 2015 18:12:48 -0000
- Subject: [newlib-cygwin] Don't generate Windows native symlinks targeting Cygwin-only targets
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8cdd7bad219ba2657e381bd0d716594c50a6ef62
commit 8cdd7bad219ba2657e381bd0d716594c50a6ef62
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Wed Nov 18 19:12:37 2015 +0100
Don't generate Windows native symlinks targeting Cygwin-only targets
* path.cc (symlink_native): Don't generate native symlink targeting
Cygwin special file. Inform the caller.
(symlink_worker): Don;t bail out in WSYM_nativestrict case if the
target is a Cygwin special file.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/ChangeLog | 7 +++++++
winsup/cygwin/path.cc | 10 ++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 37d2934..b562969 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2015-11-18 Corinna Vinschen <corinna@vinschen.de>
+ * path.cc (symlink_native): Don't generate native symlink targeting
+ Cygwin special file. Inform the caller.
+ (symlink_worker): Don;t bail out in WSYM_nativestrict case if the
+ target is a Cygwin special file.
+
+2015-11-18 Corinna Vinschen <corinna@vinschen.de>
+
* lc_msg.h: Regenerate.
2015-11-17 Yaakov Selkowitz <yselkowi@redhat.com>
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 035872d..88080e1 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1700,6 +1700,11 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
SetLastError (ERROR_FILE_NOT_FOUND);
return -1;
}
+ /* Don't allow native symlinks to Cygwin special files. However, the
+ caller shoud know because this case shouldn't be covered by the
+ default "nativestrict" behaviour, so we use a special return code. */
+ if (win32_oldpath.isspecial ())
+ return -2;
/* Convert native paths to Win32 UNC paths. */
final_newpath = win32_newpath.get_nt_native_path ();
final_newpath->Buffer[1] = L'\\';
@@ -1843,8 +1848,9 @@ symlink_worker (const char *oldpath, const char *newpath, bool isdevice)
res = symlink_native (oldpath, win32_newpath);
if (!res)
__leave;
- /* Strictly native? Too bad. */
- if (wsym_type == WSYM_nativestrict)
+ /* Strictly native? Too bad, unless the target is a Cygwin
+ special file. */
+ if (res == -1 && wsym_type == WSYM_nativestrict)
{
__seterrno ();
__leave;