This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Cygwin: make path_conv::isdevice() return false on socket files


As a result, socket files are no longer treated as lnk special files.
This prevents rename() from adding ".lnk" when renaming a socket file.

Remove a redundant !pc.issocket() from fhandler_disk_file::link().
---
 winsup/cygwin/fhandler_disk_file.cc | 4 ++--
 winsup/cygwin/path.h                | 2 +-
 winsup/cygwin/release/3.0.8         | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 193192762..fe4ee6971 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1190,10 +1190,10 @@ fhandler_disk_file::link (const char *newpath)
   char new_buf[nlen + 5];
   if (!newpc.error)
     {
-      /* If the original file is a lnk special file (except for sockets),
+      /* If the original file is a lnk special file,
 	 and if the original file has a .lnk suffix, add one to the hardlink
 	 as well. */
-      if (pc.is_lnk_special () && !pc.issocket ()
+      if (pc.is_lnk_special ()
 	  && RtlEqualUnicodePathSuffix (pc.get_nt_native_path (),
 					&ro_u_lnk, TRUE))
 	{
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 0c94c6152..5571218bd 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -179,7 +179,7 @@ class path_conv
   int issymlink () const {return path_flags & PATH_SYMLINK;}
   int is_lnk_symlink () const {return path_flags & PATH_LNK;}
   int is_known_reparse_point () const {return path_flags & PATH_REP;}
-  int isdevice () const {return dev.not_device (FH_FS) && dev.not_device (FH_FIFO);}
+  int isdevice () const {return dev.not_device (FH_FS) && dev.not_device (FH_FIFO) && !issocket ();}
   int isfifo () const {return dev.is_device (FH_FIFO);}
   int isspecial () const {return dev.not_device (FH_FS);}
   int iscygdrive () const {return dev.is_device (FH_CYGDRIVE);}
diff --git a/winsup/cygwin/release/3.0.8 b/winsup/cygwin/release/3.0.8
index e3734c9b7..11d11db6f 100644
--- a/winsup/cygwin/release/3.0.8
+++ b/winsup/cygwin/release/3.0.8
@@ -11,3 +11,6 @@ Bug Fixes
 
 - Fix a hang when opening a FIFO with O_PATH.
   Addresses: https://cygwin.com/ml/cygwin-developers/2019-06/msg00001.html
+
+- Don't append ".lnk" when renaming a socket file.
+  Addresses: https://cygwin.com/ml/cygwin/2019-07/msg00139.html
-- 
2.21.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]