* syscalls.cc (unlink): Don't even try DELETE_ON_CLOSE technique on
systems not supporting it.
This commit is contained in:
parent
56efe3a884
commit
99439385c6
|
@ -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
|
||||||
|
|
|
@ -171,26 +171,29 @@ 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. */
|
||||||
HANDLE h;
|
if (wincap.has_delete_on_close ())
|
||||||
h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih,
|
|
||||||
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
|
||||||
if (h != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
{
|
||||||
if (wincap.has_hard_links () && setattrs)
|
HANDLE h;
|
||||||
(void) SetFileAttributes (win32_name, (DWORD) win32_name);
|
h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih,
|
||||||
BOOL res = CloseHandle (h);
|
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||||
syscall_printf ("%d = CloseHandle (%p)", res, h);
|
if (h != INVALID_HANDLE_VALUE)
|
||||||
if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
|
|
||||||
|| !win32_name.isremote ())
|
|
||||||
{
|
{
|
||||||
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) succeeded");
|
if (wincap.has_hard_links () && setattrs)
|
||||||
goto ok;
|
(void) SetFileAttributes (win32_name, (DWORD) win32_name);
|
||||||
}
|
BOOL res = CloseHandle (h);
|
||||||
else
|
syscall_printf ("%d = CloseHandle (%p)", res, h);
|
||||||
{
|
if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
|
||||||
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) failed");
|
|| !win32_name.isremote ())
|
||||||
if (setattrs)
|
{
|
||||||
SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
|
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) succeeded");
|
||||||
|
goto ok;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) failed");
|
||||||
|
if (setattrs)
|
||||||
|
SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue