fd-util: add wildcard_fd_is_valid() helper and use it tree-wide

Many *at()-style helpers accept a directory fd that may be either a
regular, valid fd (>= 0) or one of the special AT_FDCWD/XAT_FDROOT
wildcard values, and open-code that check in their assertions. Add a
wildcard_fd_is_valid() helper for it and use it tree-wide.
This commit is contained in:
Lennart Poettering
2026-05-28 13:33:08 +01:00
committed by Luca Boccassi
parent d35fa257eb
commit eb3799a373
21 changed files with 57 additions and 51 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ static int context_copy(const Context *source, Context *ret) {
assert(source);
assert(ret);
assert(source->rfd >= 0 || source->rfd == AT_FDCWD || source->rfd == XAT_FDROOT);
assert(wildcard_fd_is_valid(source->rfd));
_cleanup_(context_done) Context copy = (Context) {
.rfd = source->rfd,