From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id F1A4A3865C2D; Mon, 18 Jan 2021 11:01:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1A4A3865C2D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] syscalls.cc: Fix num_links X-Act-Checkin: newlib-cygwin X-Git-Author: Ben Wijen X-Git-Refname: refs/heads/master X-Git-Oldrev: 226ed24f2ba566b7f6f1ee8969030b73e191fb46 X-Git-Newrev: 17ede0eae5d3973bbe10298d5bde223a5bdfdb97 Message-Id: <20210118110154.F1A4A3865C2D@sourceware.org> Date: Mon, 18 Jan 2021 11:01:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 11:01:55 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=17ede0eae5d3973bbe10298d5bde223a5bdfdb97 commit 17ede0eae5d3973bbe10298d5bde223a5bdfdb97 Author: Ben Wijen Date: Fri Jan 15 14:45:26 2021 +0100 syscalls.cc: Fix num_links NtQueryInformationFile on fh_ro needs FILE_READ_ATTRIBUTES to succeed. Diff: --- winsup/cygwin/syscalls.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 525efecf3..3030f6fff 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -755,8 +755,9 @@ _unlink_nt (path_conv &pc, bool shareable) if ((pc.fs_flags () & FILE_SUPPORTS_TRANSACTIONS)) start_transaction (old_trans, trans); retry_open: - status = NtOpenFile (&fh_ro, FILE_WRITE_ATTRIBUTES, &attr, &io, - FILE_SHARE_VALID_FLAGS, flags); + status = NtOpenFile (&fh_ro, + FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, + &attr, &io, FILE_SHARE_VALID_FLAGS, flags); if (NT_SUCCESS (status)) { debug_printf ("Opening %S for removing R/O succeeded",