Re: [PATCH 2/4] libfrog: fs_table_lookup_mount should realpath the argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/19/18 10:08 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Call realpath on the dir argument so that we're comparing canonical
> paths when looking for the mountpoint.  This fixes the problem where
> '/home/' doesn't match '/home' even though they refer to the same thing.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Yeah, not sure why this wasn't done.  This stuff always seems fiddly
but I can't see anything wrong with doing this, soooo

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  libfrog/paths.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/libfrog/paths.c b/libfrog/paths.c
> index 62b4eda..19ee1ea 100644
> --- a/libfrog/paths.c
> +++ b/libfrog/paths.c
> @@ -102,16 +102,19 @@ fs_table_lookup_mount(
>  	uint		i;
>  	dev_t		dev = 0;
>  	char		rpath[PATH_MAX];
> +	char		dpath[PATH_MAX];
>  
>  	if (fs_device_number(dir, &dev))
>  		return NULL;
> +	if (!realpath(dir, dpath))
> +		return NULL;
>  
>  	for (i = 0; i < fs_count; i++) {
>  		if (fs_table[i].fs_flags != FS_MOUNT_POINT)
>  			continue;
>  		if (!realpath(fs_table[i].fs_dir, rpath))
>  			continue;
> -		if (strcmp(rpath, dir) == 0)
> +		if (strcmp(rpath, dpath) == 0)
>  			return &fs_table[i];
>  	}
>  	return NULL;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux