diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 22:19:32 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 22:19:32 +0400 |
commit | c44e0ba1f543b2c7f417e7d86cd034efe455abdf (patch) | |
tree | fd131d499e789d3eb23382cde72854d5603e7f65 /winsup/cygwin/path.cc | |
parent | a9309ff5b6845b33ef54aadead2ac25cb6e1b01b (diff) |
* path.cc (symlink_info::check_shortcut): Minimize requested file
access flags.
(symlink_info::check_sysfile): Ditto. Add missing `else'.
(symlink_info::check): Only retry to open file if first try failed
with access denied.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 84dca6db0..fb69531db 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1857,7 +1857,7 @@ symlink_info::check_shortcut (HANDLE in_h) FILE_STANDARD_INFORMATION fsi; InitializeObjectAttributes (&attr, &same, 0, in_h, NULL); - status = NtOpenFile (&h, FILE_GENERIC_READ, + status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT); @@ -1941,14 +1941,15 @@ symlink_info::check_sysfile (HANDLE in_h) IO_STATUS_BLOCK io; InitializeObjectAttributes (&attr, &same, 0, in_h, NULL); - status = NtOpenFile (&h, FILE_GENERIC_READ, + status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT); if (!NT_SUCCESS (status)) set_error (EIO); - if (!NT_SUCCESS (status = NtReadFile (h, NULL, NULL, NULL, &io, cookie_buf, - sizeof (cookie_buf), NULL, NULL))) + else if (!NT_SUCCESS (status = NtReadFile (h, NULL, NULL, NULL, &io, + cookie_buf, sizeof (cookie_buf), + NULL, NULL))) { debug_printf ("ReadFile1 failed"); if (status != STATUS_END_OF_FILE) @@ -2367,7 +2368,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt, FILE_OPEN_REPARSE_POINT | FILE_OPEN_FOR_BACKUP_INTENT, &nfs_aol_ffei, sizeof nfs_aol_ffei); - if (!NT_SUCCESS (status)) + if (status == STATUS_ACCESS_DENIED) /* No right to access EAs? */ { no_ea = true; status = NtCreateFile (&h, |