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:
Zbigniew Jędrzejewski-Szmek
2023-07-13 11:12:00 +02:00
parent c8e02e408f
commit 809c3a84e1
5 changed files with 30 additions and 21 deletions
+2 -2
View File
@@ -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;