If lstat() fails with EACCES or ENOTDIR, the path we need to return in
the caller-provided buffer is that of the parent directory (which is
either unreadable or not a directory; the latter can only happen in the
case of a race) rather than that of the child we attempted to stat.
Sponsored by: Klara, Inc.