public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: NFS: fetch actual DOS attributes Date: Sat, 9 Sep 2023 21:29:21 +0000 (GMT) [thread overview] Message-ID: <20230909212921.919863858407@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8a953be5ef761d4c5cc0572eab3da2cb34b0474b commit 8a953be5ef761d4c5cc0572eab3da2cb34b0474b Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Sat Sep 9 23:10:43 2023 +0200 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Sat Sep 9 23:28:55 2023 +0200 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> Diff: --- winsup/cygwin/local_includes/path.h | 10 ++++++++-- winsup/cygwin/path.cc | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/local_includes/path.h b/winsup/cygwin/local_includes/path.h index 74f831e53fbe..c7f113f8746a 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 c631fa8869b9..6cf6e02ca88b 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)) {
reply other threads:[~2023-09-09 21:29 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230909212921.919863858407@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).