Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-03-20 04:34:53 +0300
committerChristopher Faylor <me@cgf.cx>2003-03-20 04:34:53 +0300
commit4da34970dea1656ccc686491a988452533a3ce77 (patch)
tree3f5bd769470eadf35d9215adcb11cda7452d8f1d /winsup/cygwin/syscalls.cc
parent8e3121c535a304caccc43d3f8005b95d837f63a9 (diff)
* sigproc.h (signal_fixup_after_exec): Eliminate argument in declaration.
* exceptions.cc (signal_fixup_after_exec): Eliminate argument in definition. Don't reset signal handlers after spawm. Just treat like fork/exec. * dcrt0.cc (dll_crt0_1): Don't pass PROC_SPAWN argument to signal_fixup_after_exec. * syscalls.cc (unlink): Don't change attributes of file if not readonly/system. Ditto for resetting of arguments.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 61bb08646..7c6d9a703 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -146,8 +146,15 @@ unlink (const char *ourname)
goto done;
}
- /* Allow us to delete even if read-only */
- SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
+ bool setattrs;
+ if (!((DWORD) win32_name & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
+ setattrs = false;
+ else
+ {
+ /* Allow us to delete even if read-only */
+ SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
+ setattrs = true;
+ }
/* Attempt to use "delete on close" semantics to handle removing
a file which may be open. */
HANDLE h;
@@ -155,12 +162,12 @@ unlink (const char *ourname)
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
if (h != INVALID_HANDLE_VALUE)
{
- (void) SetFileAttributes (win32_name, (DWORD) win32_name);
+ if (wincap.has_hard_links () && setattrs)
+ (void) SetFileAttributes (win32_name, (DWORD) win32_name);
BOOL res = CloseHandle (h);
syscall_printf ("%d = CloseHandle (%p)", res, h);
- if (!win32_name.isremote ()
- || (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
- || wincap.has_delete_on_close ()))
+ if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
+ || !win32_name.isremote ())
{
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) succeeded");
goto ok;
@@ -168,7 +175,8 @@ unlink (const char *ourname)
else
{
syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) failed");
- SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
+ if (setattrs)
+ SetFileAttributes (win32_name, (DWORD) win32_name & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
}
}