summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2aba80d7f..d33b60c8c 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -340,7 +340,9 @@ fhandler_base::open (int flags, mode_t mode)
goto done;
}
- if (flags & O_CREAT && get_device () == FH_DISK)
+ // Attributes may be set only if a file is _really_ created.
+ if (flags & O_CREAT && get_device () == FH_DISK
+ && GetLastError () != ERROR_ALREADY_EXISTS)
set_file_attribute (has_acls (), get_win32_name (), mode);
namehash_ = hash_path_name (0, get_win32_name ());