From e563a4d5b812b3691caf7e9bdbd40b66213c5545 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 7 Dec 2006 17:53:05 +0000 Subject: [PATCH] * syscalls.cc (unlink_nt): Open native symlinks with FILE_OPEN_REPARSE_POINT flag. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/syscalls.cc | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5815dc1ca..0805a1b51 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2006-12-07 Corinna Vinschen + + * syscalls.cc (unlink_nt): Open native symlinks with + FILE_OPEN_REPARSE_POINT flag. + 2006-12-07 Corinna Vinschen * ntdll.h (STATUS_DELETE_PENDING): Define. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 1e23323e7..928e1c64b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -207,6 +207,10 @@ unlink_nt (path_conv &win32_name, bool setattrs) 2K3 and in all cases, DeleteFile works, "delete on close" does not. */ if (!win32_name.isremote ()) flags |= FILE_DELETE_ON_CLOSE; + /* Add the reparse point flag to native symlinks, otherwise we remove the + target, not the symlink. */ + if (win32_name.is_rep_symlink ()) + flags |= FILE_OPEN_REPARSE_POINT; win32_name.get_nt_native_path (upath); InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE | OBJ_INHERIT,