[Toybox] [musl] Re: faccessat and AT_SYM_NOFOLLOW

Rich Felker dalias at libc.org
Mon Sep 29 09:40:29 PDT 2014


On Mon, Sep 29, 2014 at 08:27:19PM +0400, Alexander Monakov wrote:
> Isn't the reason for faccessat call before unlink is that rm without the -f
> flag is explicitely specified to ask for confirmation when the file is not
> writable?

This may be true (it was never stated when I asked about the purpose),
but in that case, faccessat still won't give the correct result unless
you use AT_EACCESS (which is broken with glibc and very expensive with
musl). The right way to achieve this would be to attempt to open the
file (or performing some other operation that would check for write
access with the correct effective/fs uid/gid) for writing before
unlinking it.

Rich

 1412008829.0


More information about the Toybox mailing list