Re: [PATCH V2] xfsprogs: libxcmd/paths: make all comparisons using realpath'd paths

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

 



On 7/14/14, 7:34 AM, Brian Foster wrote:
> On Fri, Jul 11, 2014 at 08:34:24PM -0500, Eric Sandeen wrote:
>> Both mountpoints and devices can be symlinks, so given a path
>> to look for, and mountpoints/devices from the system, use
>> realpath() on *everything* before making the comparison to see
>> if our path is a match.
>>
>> So, with symlinks for mount points as well as for devices:

<snip>

>> @@ -337,7 +350,7 @@ fs_table_initialise_mounts(
>>  {
>>  	struct statfs	*stats;
>>  	int		i, count, error, found;
>> -	char		*rpath = NULL;
>> +	char		*rpath = NULL, *rmntfromname= NULL, *rmntonname= NULL;
> 
> A couple missing spaces before '=' here.

whoopsies

> The fundamental change looks good, but the memory allocation handling
> seems a little ugly to me. A 'next:' label in the loop that frees the
> path buffers is cleaner IMO. Another option could be to put a couple
> PATH_MAX buffers on the stack or allocate them directly to also
> eliminate the realpath() return value assignment..?

Yeah, that probably makes more sense, thanks.

-eric


_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux