fd-util: when re-opening a directory with fd_reopen() go via openat(…, ".", …)
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Oct 2021 08:21:03 +0000 (10:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Oct 2021 12:05:12 +0000 (14:05 +0200)
commitb4f73d1e1774b4512d0e396b7060f2a2ff5f0fe3
tree34994156c4a83df14a335e51d5af73a9f9bf4224
parente0e914eaf86e2d10454f7b9dae1295d3f3213a49
fd-util: when re-opening a directory with fd_reopen() go via openat(…, ".", …)

This adds a tiny shortcut to fd_reopen(): if we are about to reopen the
fd via O_DIRECTORY then we know it#s a directory and we might as well
reopen it via opening "." using the fd as "at fd" in openat().

This has the benefit that we don't need /proc/self/fd/ around for this
special case: fewer sources of errors.
src/basic/fd-util.c