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:
committed by
Luca Boccassi
parent
d35fa257eb
commit
eb3799a373
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user