[Toybox] XBSPATH() bug

Rob Landley rob at landley.net
Fri Apr 26 06:56:31 PDT 2013


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
 1366984591.0


More information about the Toybox mailing list