Introduce RET_GATHER and use it in src/shared/
The idea is to make it easier to implement the common pattern of accumulating errors (negative values) in an accumulator to return the first error.
This commit is contained in:
@@ -218,8 +218,8 @@ int devnode_acl_all(const char *seat,
|
||||
k = devnode_acl(n, flush, del, old_uid, add, new_uid);
|
||||
if (k == -ENOENT)
|
||||
log_debug("Device %s disappeared while setting ACLs", n);
|
||||
else if (k < 0 && r == 0)
|
||||
r = k;
|
||||
else
|
||||
RET_GATHER(r, k);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user