diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4a8042be6..16106955e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2005-05-03 Corinna Vinschen + + * 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 * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 2cbecc924..65fbb8320 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -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);