From 7ae89fe708a8137a3f47d39ff2f93bea1c1ef3fc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:41:45 +0100 Subject: [PATCH] Cygwin: path_conv: rename is_rep_symlink to is_known_reparse_point ...in preparation of reusing this flag for other types of reparse points, not only symlinks. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.cc | 6 +++--- winsup/cygwin/fhandler_disk_file.cc | 2 +- winsup/cygwin/path.cc | 2 +- winsup/cygwin/path.h | 2 +- winsup/cygwin/syscalls.cc | 15 ++++++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 93bbdfed2..45ae1ad97 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -594,9 +594,9 @@ fhandler_base::open (int flags, mode_t mode) if (get_device () == FH_FS) { - /* Add the reparse point flag to native symlinks, otherwise we open the - target, not the symlink. This would break lstat. */ - if (pc.is_rep_symlink ()) + /* Add the reparse point flag to known repares points, otherwise we + open the target, not the reparse point. This would break lstat. */ + if (pc.is_known_reparse_point ()) options |= FILE_OPEN_REPARSE_POINT; /* O_TMPFILE files are created with delete-on-close semantics, as well diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 439f0ebaf..66ebee8c6 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1977,7 +1977,7 @@ readdir_get_ino (const char *path, bool dot_dot) pc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (pc.is_rep_symlink () + | (pc.is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0))) ) { diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index da4598931..d9968ee2f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1013,7 +1013,7 @@ path_conv::check (const char *src, unsigned opt, saw_symlinks = 1; if (component == 0 && !need_directory && (!(opt & PC_SYM_FOLLOW) - || (is_rep_symlink () + || (is_known_reparse_point () && (opt & PC_SYM_NOFOLLOW_REP)))) { /* last component of path is a symlink. */ diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 8a7354017..f55804d72 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -183,7 +183,7 @@ class path_conv } int issymlink () const {return path_flags & PATH_SYMLINK;} int is_lnk_symlink () const {return path_flags & PATH_LNK;} - int is_rep_symlink () const {return path_flags & PATH_REP;} + 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 isfifo () const {return dev.is_device (FH_FIFO);} int isspecial () const {return dev.not_device (FH_FS);} diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 31b7629e8..9bae6dc0b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -705,9 +705,9 @@ unlink_nt (path_conv &pc) pc.get_nt_native_path (), pc.isdir ()); ACCESS_MASK access = DELETE; ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT; - /* Add the reparse point flag to native symlinks, otherwise we remove the - target, not the symlink. */ - if (pc.is_rep_symlink ()) + /* Add the reparse point flag to known reparse points, otherwise we remove + the target, not the reparse point. */ + if (pc.is_known_reparse_point ()) flags |= FILE_OPEN_REPARSE_POINT; pc.get_object_attr (attr, sec_none_nih); @@ -2477,7 +2477,8 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) ULONG sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | (oldpc.fs_is_samba () ? 0 : FILE_SHARE_DELETE); ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT - | (oldpc.is_rep_symlink () ? FILE_OPEN_REPARSE_POINT : 0); + | (oldpc.is_known_reparse_point () + ? FILE_OPEN_REPARSE_POINT : 0); status = NtOpenFile (&fh, access, oldpc.get_object_attr (attr, sec_none_nih), &io, sharing, flags); @@ -2541,7 +2542,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) dstpc->get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (dstpc->is_rep_symlink () + | (dstpc->is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)); if (!NT_SUCCESS (status)) { @@ -2575,7 +2576,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) (removepc ?: dstpc)->get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | ((removepc ?: dstpc)->is_rep_symlink () + | ((removepc ?: dstpc)->is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)))) { FILE_INTERNAL_INFORMATION ofii, nfii; @@ -2651,7 +2652,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) oldpc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (oldpc.is_rep_symlink () + | (oldpc.is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)); if (NT_SUCCESS (status)) {