Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-09-10 00:10:43 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-09-10 00:28:55 +0300
commit8a953be5ef761d4c5cc0572eab3da2cb34b0474b (patch)
treeda4f8c7ba4c85b03747ff5775eb3b4ee6e3739bc /winsup
parent5302638f77398978cd5403e00925d8f482442c84 (diff)
Cygwin: NFS: fetch actual DOS attributes
MSFT NFSv3 fakes DOS attributes based on file type and permissions. Rather than just faking FILE_ATTRIBUTE_DIRECTORY for dirs, fetch the "real" DOS attributes returned by NFS. This allows to handle the "R/O" attribute on shortcut files and thus reading and creating device shortcut files on NFS. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/local_includes/path.h10
-rw-r--r--winsup/cygwin/path.cc2
2 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/local_includes/path.h b/winsup/cygwin/local_includes/path.h
index 74f831e53..c7f113f87 100644
--- a/winsup/cygwin/local_includes/path.h
+++ b/winsup/cygwin/local_includes/path.h
@@ -125,10 +125,16 @@ public:
return nfs ? nfsattr ()->fileid
: fai ()->InternalInformation.IndexNumber.QuadPart;
}
- inline DWORD get_dosattr (bool nfs) const
+ inline DWORD get_dosattr (HANDLE h, bool nfs) const
{
if (nfs)
- return (nfsattr ()->type & 7) == NF3DIR ? FILE_ATTRIBUTE_DIRECTORY : 0;
+ {
+ IO_STATUS_BLOCK io;
+ FILE_BASIC_INFORMATION fbi;
+
+ NtQueryInformationFile (h, &io, &fbi, sizeof fbi, FileBasicInformation);
+ return fbi.FileAttributes;
+ }
return fai ()->BasicInformation.FileAttributes;
}
};
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c631fa886..6cf6e02ca 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3259,7 +3259,7 @@ restart:
{
status = conv_hdl.get_finfo (h, fs.is_nfs ());
if (NT_SUCCESS (status))
- fileattr = conv_hdl.get_dosattr (fs.is_nfs ());
+ fileattr = conv_hdl.get_dosattr (h, fs.is_nfs ());
}
if (!NT_SUCCESS (status))
{