[PATCH V2] xfsprogs: libxcmd/paths: make all comparisons using realpath'd paths
Eric Sandeen
sandeen at sandeen.net
Mon Jul 14 09:11:22 CDT 2014
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
More information about the xfs
mailing list