From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 919863858407; Sat, 9 Sep 2023 21:29:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 919863858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694294961; bh=srWJ8Grfbb/hk/onKwFzSZ0ZGdD82KhwUnKSsFNXI+8=; h=From:To:Subject:Date:From; b=J/g6RQfJM+ecOqFByanOuIhsg1PsYBlvKwSVUE0RSQI7DiT2G7PKEafeCtF/Cgfro 82KkdVbm9krQn9Eer3uqZ72Xsz1P0dfW248DBs2Irxc37uAfCkD6fc+tXIjuccOfil 51gHYXKjdWUEGgj0GcuIIC8/2kC3ZtkIGC0n29iA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: NFS: fetch actual DOS attributes X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 5302638f77398978cd5403e00925d8f482442c84 X-Git-Newrev: 8a953be5ef761d4c5cc0572eab3da2cb34b0474b Message-Id: <20230909212921.919863858407@sourceware.org> Date: Sat, 9 Sep 2023 21:29:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8a953be5ef7= 61d4c5cc0572eab3da2cb34b0474b commit 8a953be5ef761d4c5cc0572eab3da2cb34b0474b Author: Corinna Vinschen AuthorDate: Sat Sep 9 23:10:43 2023 +0200 Commit: Corinna Vinschen CommitDate: Sat Sep 9 23:28:55 2023 +0200 Cygwin: NFS: fetch actual DOS attributes =20 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. =20 This allows to handle the "R/O" attribute on shortcut files and thus reading and creating device shortcut files on NFS. =20 Signed-off-by: Corinna Vinschen 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_incl= udes/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) =3D=3D NF3DIR ? FILE_ATTRIBUTE_DIRECTO= RY : 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 =3D conv_hdl.get_finfo (h, fs.is_nfs ()); if (NT_SUCCESS (status)) - fileattr =3D conv_hdl.get_dosattr (fs.is_nfs ()); + fileattr =3D conv_hdl.get_dosattr (h, fs.is_nfs ()); } if (!NT_SUCCESS (status)) {