OSDN Git Service

* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't treat
authorcorinna <corinna>
Tue, 3 May 2005 19:03:16 +0000 (19:03 +0000)
committercorinna <corinna>
Tue, 3 May 2005 19:03:16 +0000 (19:03 +0000)
inability to open file as failure if only SetFileAttributes is
going to be called.  Only call set_file_attribute if really necessary.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_disk_file.cc

index 4a8042b..1610695 100644 (file)
@@ -1,5 +1,11 @@
 2005-05-03  Corinna Vinschen  <corinna@vinschen.de>
 
+       * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't treat
+       inability to open file as failure if only SetFileAttributes is
+       going to be called.  Only call set_file_attribute if really necessary.
+
+2005-05-03  Corinna Vinschen  <corinna@vinschen.de>
+
        * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call.
 
 2005-05-01  Christopher Faylor  <cgf@timesys.com>
index 2cbecc9..65fbb83 100644 (file)
@@ -466,10 +466,15 @@ fhandler_disk_file::fchmod (mode_t mode)
     {
       query_open (query_write_control);
       if (!(oret = open (O_BINARY, 0)))
-       return -1;
+       {
+         /* If the file couldn't be opened, that's really only a problem if
+            ACLs or EAs should get written. */
+         if ((allow_ntsec && pc.has_acls ()) || allow_ntea)
+           return -1;
+       }
     }
 
-  if (wincap.has_security ())
+  if ((allow_ntsec && pc.has_acls ()) || allow_ntea)
     {
       if (!allow_ntsec && allow_ntea) /* Not necessary when manipulating SD. */
        SetFileAttributes (pc, (DWORD) pc & ~FILE_ATTRIBUTE_READONLY);