fd-util: add new helper fd_reopen_conditional()
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Nov 2022 14:29:25 +0000 (15:29 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 29 Nov 2022 14:32:47 +0000 (15:32 +0100)
commit5f5865f0ad8069ae01119e34c048a91eb5057143
tree5a3a77e6251230a53371511b066e1427e8d92986
parent04613753260cf1df47c6c1fbed9b02efd4f8af48
fd-util: add new helper fd_reopen_conditional()

This is a wrapper around fd_reopen() that will reopen an fd if the
F_GETFL flags indicate this is necessary, and otherwise not.

This is useful for various utility calls that shall be able to operate
on O_PATH and without it, and might need to convert between the two
depending on what's passed in.
src/basic/fd-util.c
src/basic/fd-util.h
src/test/test-fd-util.c