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:
authorCorinna Vinschen <corinna@vinschen.de>2011-03-08 17:26:15 +0300
committerCorinna Vinschen <corinna@vinschen.de>2011-03-08 17:26:15 +0300
commit69d7815eae1b235e4ca81bbc22293402435da2da (patch)
tree58ca20e6dcdcc57afbf8f1199f950c621a6767fa /winsup/cygwin/fhandler.cc
parent6777e53972bd4587dca1d740a9b9e0622d5016ba (diff)
* fhandler.cc (fhandler_base::open): When creating a file on a
filesystem supporting ACLs, create the file with WRITE_DAC access. Explain why. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for directories. * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets. * path.cc (symlink_worker): Ditto for symlinks. * security.cc (get_file_sd): Always call GetSecurityInfo for directories on XP and Server 2003. Improve comment to explain why. (set_file_attribute): Explicitely cast mode_t value to bool in call to get_file_sd. * wincap.h (wincaps::use_get_sec_info_on_dirs): New element. * wincap.cc: Implement above element throughout.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index cea9c1bb0..963635c70 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -577,6 +577,13 @@ fhandler_base::open (int flags, mode_t mode)
/* If mode has no write bits set, and ACLs are not used, we set
the DOS R/O attribute. */
file_attributes |= FILE_ATTRIBUTE_READONLY;
+ else if (!exists () && has_acls ())
+ /* If we are about to create the file and the filesystem supports
+ ACLs, we will overwrite the DACL after the call to NtCreateFile.
+ This requires a handle with additional WRITE_DAC access,
+ otherwise set_file_sd has to open the file again. */
+ access |= WRITE_DAC;
+
/* The file attributes are needed for later use in, e.g. fchmod. */
pc.file_attributes (file_attributes);
}