[Top] [All Lists]

Re: [PATCH V2] xfsprogs: libxcmd/paths: make all comparisons using realp

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH V2] xfsprogs: libxcmd/paths: make all comparisons using realpath'd paths
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Mon, 14 Jul 2014 09:11:22 -0500
Cc: Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140714123430.GD14369@xxxxxxxxxxxxxxx>
References: <53C09034.3070203@xxxxxxxxxx> <53C090A0.9050403@xxxxxxxxxxx> <20140714123430.GD14369@xxxxxxxxxxxxxxx>
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:


>> @@ -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.


> 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.


<Prev in Thread] Current Thread [Next in Thread>