Skip to content

Commit ae6683e

Browse files
committed
Cygwin: open: only fix file attributes when trying to create file
Only try to fix the cached DOS attributes if the caller actually tried to create the file. Otherwise the fixup code is called even in cases where we open the file with minimal query access bits and NtQueryInformationFile() could fail with STATUS_ACCESS_DENIED and the new cached DOS attributes are wrong again. Fixes: 37c49de ("Cygwin: open: only fix up cached DOS file attributes for on-disk files") Signed-off-by: Corinna Vinschen <[email protected]> (cherry picked from commit c86c08e0ab41ba8d181876a4bdcfa4cd62264827)
1 parent dfa0973 commit ae6683e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

winsup/cygwin/fhandler/base.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,9 @@ fhandler_base::open (int flags, mode_t mode)
720720
goto done;
721721
}
722722

723-
if (get_device () == FH_FS)
723+
if (get_device () == FH_FS && (flags & O_CREAT))
724724
{
725-
/* Fix up file attributes, they are desperately needed later.
725+
/* Fix up file attributes if we just made an attempt to create the file.
726726
727727
Originally we only did that in the FILE_CREATED case below, but that's
728728
insufficient:

winsup/cygwin/release/3.6.4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ Fixes:
2525
- Fix potential crashing a process PID by accessing /proc/PID/maps
2626
in parallel.
2727
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258198.html
28+
29+
- Fix ACL operations on directories.
30+
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258433.html

0 commit comments

Comments
 (0)