[PATCH] Cygwin: fstat_helper: always use handle in call to get_file_attribute

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Jan 31 11:49:00 GMT 2020


On Jan 30 12:01, Ken Brown wrote:
> When fhandler_base::fstat_helper is called, the handle h returned by
> get_stat_handle() should be pc.handle() and should be safe to use for
> getting the file information.  Previously, the call to
> get_file_attribute() for FIFOs set the first argument to NULL instead
> of h, thereby forcing the file to be opened for fetching the security
> descriptor in get_file_sd().
> ---
>  winsup/cygwin/fhandler_disk_file.cc | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
> index f362e31e3..ad63af824 100644
> --- a/winsup/cygwin/fhandler_disk_file.cc
> +++ b/winsup/cygwin/fhandler_disk_file.cc
> @@ -394,13 +394,14 @@ fhandler_base::fstat_fs (struct stat *buf)
>    return res;
>  }
>  
> +/* Called by fstat_by_handle and fstat_by_name. */
>  int __reg2
>  fhandler_base::fstat_helper (struct stat *buf)
>  {
>    IO_STATUS_BLOCK st;
>    FILE_COMPRESSION_INFORMATION fci;
> -  HANDLE h = get_stat_handle ();
> -  PFILE_ALL_INFORMATION pfai = pc.fai ();
> +  HANDLE h = get_stat_handle ();      /* Should always be pc.handle(). */
> +  pfile_all_information pfai = pc.fai ();

This lower-casing PFILE_ALL_INFORMATION looks like a typo.  Other than
that the patch looks ok.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200131/5a163d4d/attachment.sig>


More information about the Cygwin-patches mailing list