* syscalls.cc (unlink): Don't even try DELETE_ON_CLOSE technique on

systems not supporting it.
This commit is contained in:
Corinna Vinschen 2003-10-08 09:17:08 +00:00
parent 56efe3a884
commit 99439385c6
2 changed files with 26 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2003-10-08 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (unlink): Don't even try DELETE_ON_CLOSE technique on
systems not supporting it.
2003-10-02 Christopher Faylor <cgf@redhat.com> 2003-10-02 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that * dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that

View File

@ -171,6 +171,8 @@ unlink (const char *ourname)
} }
/* Attempt to use "delete on close" semantics to handle removing /* Attempt to use "delete on close" semantics to handle removing
a file which may be open. */ a file which may be open. */
if (wincap.has_delete_on_close ())
{
HANDLE h; HANDLE h;
h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih, h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih,
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0); OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
@ -193,6 +195,7 @@ unlink (const char *ourname)
SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)); SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
} }
} }
}
/* Try a delete with attributes reset */ /* Try a delete with attributes reset */
if (DeleteFile (win32_name)) if (DeleteFile (win32_name))