syscalls.cc: Fix num_links

NtQueryInformationFile on fh_ro needs FILE_READ_ATTRIBUTES
to succeed.
This commit is contained in:
Ben Wijen 2021-01-15 14:45:26 +01:00 committed by Corinna Vinschen
parent 226ed24f2b
commit 17ede0eae5
1 changed files with 3 additions and 2 deletions

View File

@ -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",