aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-09-17 09:10:53 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-09-17 09:10:53 +0000
commitaf444ab7bea5196f32911ae82205d613dcde0034 (patch)
tree03b76cc3986e88fbcb463e63da4811f975d003b7 /winsup/cygwin
parent95a12a8594fb9c126c159c95b85abecb0bd01e0d (diff)
downloadnewlib-af444ab7bea5196f32911ae82205d613dcde0034.zip
newlib-af444ab7bea5196f32911ae82205d613dcde0034.tar.gz
newlib-af444ab7bea5196f32911ae82205d613dcde0034.tar.bz2
* syscalls.cc (unlink): Don't use "delete on close" on remote shares.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/syscalls.cc20
2 files changed, 22 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4970631..b567cfa 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,9 @@
2004-09-17 Corinna Vinschen <corinna@vinschen.de>
+ * syscalls.cc (unlink): Don't use "delete on close" on remote shares.
+
+2004-09-17 Corinna Vinschen <corinna@vinschen.de>
+
* cygwin.din (_impure_ptr): And export again. There are libs out there.
2004-09-16 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index ddb0da7..0aec709 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -175,8 +175,24 @@ unlink (const char *ourname)
| FILE_ATTRIBUTE_SYSTEM));
}
/* Attempt to use "delete on close" semantics to handle removing
- a file which may be open. */
- if (wincap.has_delete_on_close ())
+ a file which may be open.
+
+ CV 2004-09-17: Not if the file is on a remote share. If two processes
+ have open handles on a file and one of them calls unlink, then it
+ happens that the file is remove from the remote share even though the
+ other process still has an open handle. This other process than gets
+ Win32 error 59, ERROR_UNEXP_NET_ERR when trying to access the file.
+
+ For some reason, that does not happen when using DeleteFile, which
+ nicely succeeds but still, the file is available for the other process.
+ To reproduce, mount /tmp on a remote share and call
+
+ bash -c "cat << EOF"
+
+ Microsoft KB 837665 describes this problem as a bug in 2K3, but I have
+ reproduced it on shares on Samba 2.2.8, Samba 3.0.2, NT4SP6, XP64SP1 and
+ 2K3 and in all cases, DeleteFile works, "delete on close" does not. */
+ if (!win32_name.isremote () && wincap.has_delete_on_close ())
{
HANDLE h;
h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih,