On Jan 20 17:10, Ben Wijen wrote:
> path_conv already knows the IndexNumber, so just use it.

Yeah, this looks like a vestige from before the time we switched to
FILE_ALL_INFORMATION.

> 
> This commit also fixes the potential handle leak.
> ---
>  winsup/cygwin/fhandler_disk_file.cc | 24 ++++++------------------
>  1 file changed, 6 insertions(+), 18 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_disk_file.cc 
> b/winsup/cygwin/fhandler_disk_file.cc
> index fe04f832b..39f914a59 100644
> --- a/winsup/cygwin/fhandler_disk_file.cc
> +++ b/winsup/cygwin/fhandler_disk_file.cc
> @@ -2029,9 +2029,6 @@ readdir_get_ino (const char *path, bool dot_dot)
>  {
>    char *fname;
>    struct stat st;
> -  HANDLE hdl;
> -  OBJECT_ATTRIBUTES attr;
> -  IO_STATUS_BLOCK io;
>    ino_t ino = 0;
>  
>    if (dot_dot)
> @@ -2044,26 +2041,17 @@ readdir_get_ino (const char *path, bool dot_dot)
>        path = fname;
>      }
>    path_conv pc (path, PC_SYM_NOFOLLOW | PC_POSIX | PC_KEEP_HANDLE);

Given that this function doesn't need a handle anymore, PC_KEEP_HANDLE
can go away.

> -  if (pc.isspecial ())
> +  if (pc.isgood_inode (pc.fai ()->InternalInformation.IndexNumber.QuadPart))
> +    ino = pc.fai ()->InternalInformation.IndexNumber.QuadPart;

This ignores the fact that the file could be on an NFS filesystem.
Rather than using pc.fai ()->InternalInformation.IndexNumber.QuadPart,
this call should use pc.get_ino ().


Thanks,
Corinna

Reply via email to