diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 12fd4db4a..0054a280a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2007-07-27 Corinna Vinschen + + * fhandler.h (enum query_state): Drop redundant query_stat_control. + * fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to + access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening + for writing. Always set security attributes to avoid calling + has_acls. + * fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to + open file twice. + 2007-07-26 Corinna Vinschen * dir.cc (readdir_worker): Drop dir parameter from call to diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 0ee0bbb8a..ac9527ad8 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -483,10 +483,6 @@ fhandler_base::open (int flags, mode_t mode) access = READ_CONTROL | FILE_READ_ATTRIBUTES; create_options = FILE_OPEN_FOR_BACKUP_INTENT; break; - case query_stat_control: - access = READ_CONTROL | FILE_READ_ATTRIBUTES; - create_options = FILE_OPEN_FOR_BACKUP_INTENT; - break; case query_write_control: access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES; create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY; @@ -503,8 +499,9 @@ fhandler_base::open (int flags, mode_t mode) } else if ((flags & O_ACCMODE) == O_WRONLY) { - access = GENERIC_WRITE | FILE_READ_ATTRIBUTES; - create_options = FILE_OPEN_FOR_RECOVERY; + access = GENERIC_WRITE | READ_CONTROL | FILE_READ_ATTRIBUTES; + create_options = FILE_OPEN_FOR_BACKUP_INTENT + | FILE_OPEN_FOR_RECOVERY; } else { @@ -560,7 +557,7 @@ fhandler_base::open (int flags, mode_t mode) /* If the file should actually be created and ntsec is on, set files attributes. */ - if (allow_ntsec && has_acls ()) + if (allow_ntsec) { set_security_attribute (mode, &sa, sd); attr.SecurityDescriptor = sa.lpSecurityDescriptor; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index cf1f27cc0..af505e8c4 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -86,9 +86,8 @@ enum query_state { no_query = 0, query_read_control = 1, query_read_attributes = 2, - query_stat_control = 3, - query_write_control = 4, - query_write_attributes = 5 + query_write_control = 3, + query_write_attributes = 4 }; class fhandler_base diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index dd2034095..ac81a0832 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -425,16 +425,8 @@ fhandler_base::fstat_fs (struct __stat64 *buf) res = fstat_by_name (buf); return res; } - query_open (query_stat_control); - if (!(oret = open_fs (open_flags, 0)) && get_errno () == EACCES) - { - /* If we couldn't open the file, try a query open with no permissions. - This allows us to determine *some* things about the file, at least. */ - pc.set_exec (0); - query_open (query_read_attributes); - oret = open_fs (open_flags, 0); - } - + query_open (query_read_attributes); + oret = open_fs (open_flags, 0); if (oret) { /* We now have a valid handle, regardless of the "nohandle" state.