diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-09-22 15:52:02 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-09-22 15:52:02 +0000 |
commit | f3810c7281c1e3dca7df0b3e013c73c25bb98954 (patch) | |
tree | 7e0897e00d78a3bd26b61592db2576119c3b5296 /winsup/cygwin/path.h | |
parent | f3a61fc4aa4e45deb231e535134039483f585392 (diff) | |
download | newlib-f3810c7281c1e3dca7df0b3e013c73c25bb98954.zip newlib-f3810c7281c1e3dca7df0b3e013c73c25bb98954.tar.gz newlib-f3810c7281c1e3dca7df0b3e013c73c25bb98954.tar.bz2 |
* fhandler.h (fhandler_base::fstat_helper): Declare with additional
file attributes argument.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use
file attributes evaluated from NtQueryFileInformation or
FileInformationByHandle in call to fstat_helper.
Set pc.fileattr from just evaluated file attributes here.
(fhandler_base::fstat_by_name): Use file attributes evaluated from
FindFileFirst or default attribute in call to fstat_helper.
Set pc.fileattr from just evaluated file attributes here.
(fhandler_base::fstat_helper): Use file attributes given as argument,
not file attributes stored in this fhandler, since this information
is potentially wrong. Add comment to explain this.
* path.h (has_attribute): New global inline function.
(path_conv::set_attributes): New method to change fileattr.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r-- | winsup/cygwin/path.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 14c23eb..de37ff2 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -14,6 +14,13 @@ details. */ #include <fcntl.h> #include <ntdef.h> +inline bool +has_attribute (DWORD attributes, DWORD attribs_to_test) +{ + return attributes != INVALID_FILE_ATTRIBUTES + && (attributes & attribs_to_test); +} + enum executable_states { is_executable, @@ -161,6 +168,7 @@ class path_conv bool isro () const {return !!(path_flags & PATH_RO);} bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;} bool has_attribute (DWORD x) const {return exists () && (fileattr & x);} + void set_attributes (DWORD x) {fileattr = x;} int isdir () const {return has_attribute (FILE_ATTRIBUTE_DIRECTORY);} executable_states exec_state () { |