summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2019-07-20 17:55:12 -0400
committerKen Brown <kbrown@cornell.edu>2019-07-22 08:15:16 -0400
commit73f819534da5e5e78d3266931a895c104436e6b6 (patch)
tree23e156a90f56804dcc760dfb00a5005615b09c7b
parentaf4d29e1067cf918d380404a16c76fb2b4b2bc9c (diff)
downloadcygnal-73f819534da5e5e78d3266931a895c104436e6b6.tar.gz
cygnal-73f819534da5e5e78d3266931a895c104436e6b6.tar.bz2
cygnal-73f819534da5e5e78d3266931a895c104436e6b6.zip
Cygwin: socket files are not lnk special files
Change path_conv::is_lnk_special() so that it returns false on socket files. is_lnk_special() is called by rename2() in order to deal with special files (FIFOs and symlinks, for example) whose Win32 names usually have a ".lnk" suffix. Socket files do not fall into this category, and this change prevents ".lnk" from being appended erroneously when such files are renamed. Remove a now redundant !pc.issocket() from fhandler_disk_file::link().
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc4
-rw-r--r--winsup/cygwin/path.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 84d86456b..32381a0b0 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 95a9dec6f..e76157bd4 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -184,7 +184,9 @@ class path_conv
int isspecial () const {return dev.not_device (FH_FS);}
int iscygdrive () const {return dev.is_device (FH_CYGDRIVE);}
int is_fs_special () const {return dev.is_fs_special ();}
- int is_lnk_special () const {return (isdevice () && is_fs_special ())
+
+ int is_lnk_special () const {return (isdevice () && is_fs_special ()
+ && !issocket ())
|| isfifo () || is_lnk_symlink ();}
#ifdef __WITH_AF_UNIX
int issocket () const {return dev.is_device (FH_LOCAL)