[Toybox] XBSPATH() bug
Ashwini Sharma
ak.ashwini at gmail.com
Sun Apr 28 21:22:07 PDT 2013
Yep! I had a case that file belongs to some other user.... /dev/sda1 on my
system.
may be doing FACCESSAT would be better.
-Ashwini
On Fri, Apr 26, 2013 at 7:26 PM, Rob Landley <rob at landley.net> wrote:
> On 04/25/2013 12:12:20 AM, Ashwini Sharma wrote:
>
>> Hi Rob,
>>
>> Calling xabspath() function with "exact=1", makes sure that the last path
>> component exists.
>>
>> I think the decision making statement
>>
>> fd = openat(dirfd, s, 0);
>> if (fd == -1 && (exact || todo || errno != ENOENT)) goto error;
>>
>> will jump to error:, when openat fails, though the 's' is the last
>> component in the path.
>>
>> Failing to open the last component with errno != ENOENT doesn't mean the
>> component doesn't exist.
>>
>
> Ah, you're referring to a file that exists but belongs to another user, or
> is chmod 000 or similar? So the last test should be faccessat(F_OK)?
>
>
> The check should be modified to see if the fail happens at last component
>> or otherwise.
>>
>
> I don't know what you mean by that. Above is my guess?
>
> Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130429/9743493e/attachment-0006.htm>
More information about the Toybox
mailing list