Skip to content

Commit

Permalink
Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
Browse files Browse the repository at this point in the history
If FILE_DIRECTORY_FILE is given, FILE_OPEN_NO_RECALL is not allowed,
otherwise NtCreateFile returns STATUS_INVALID_PARAMETER.

Drop FILE_OPEN_NO_RECALL where FILE_DIRECTORY_FILE is specified.

Fixes: f6b56ab ("Cygwin: try to avoid recalling offline files")
Reported-by: Bruce Jerrick <[email protected]>
Signed-off-by: Corinna Vinschen <[email protected]>
  • Loading branch information
github-cygwin committed Apr 4, 2024
1 parent b896891 commit e00cb12
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion winsup/cygwin/fhandler/disk_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ fhandler_base::fstat_by_name (struct stat *buf)
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_NO_RECALL
| FILE_OPEN_FOR_BACKUP_INTENT
| FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
Expand Down
2 changes: 0 additions & 2 deletions winsup/cygwin/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ getfileattr (const char *path, bool caseinsensitive) /* path has to be always ab
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_NO_RECALL
| FILE_OPEN_FOR_BACKUP_INTENT
| FILE_DIRECTORY_FILE);
if (NT_SUCCESS (status))
Expand Down Expand Up @@ -3321,7 +3320,6 @@ symlink_info::check (char *path, const suffix_info *suffixes, fs_info &fs,
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&dattr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_NO_RECALL
| FILE_OPEN_FOR_BACKUP_INTENT
| FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
Expand Down
6 changes: 6 additions & 0 deletions winsup/cygwin/release/3.5.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Fixes:
------

- Fix regression in 3.5.3 which fails to open files for stat(2) if the
file is opened exclusively by another process.
Addresses: https://cygwin.com/pipermail/cygwin/2024-April/255811.html

0 comments on commit e00cb12

Please sign in to comment.