Also, when we fail, don't clobber the return value.
This brings the call more in-line with our usual coding style, and
removes surprises.
None of the callers seemed to care about this behaviour.
return 0;
}
-int cg_mask_from_string(const char *value, CGroupMask *mask) {
- assert(mask);
+int cg_mask_from_string(const char *value, CGroupMask *ret) {
+ CGroupMask m = 0;
+
+ assert(ret);
assert(value);
for (;;) {
if (v < 0)
continue;
- *mask |= CGROUP_CONTROLLER_TO_MASK(v);
+ m |= CGROUP_CONTROLLER_TO_MASK(v);
}
+
+ *ret = m;
return 0;
}
int cg_mask_supported(CGroupMask *ret) {
- CGroupMask mask = 0;
+ CGroupMask mask;
int r;
/* Determines the mask of supported cgroup controllers. Only
/* In the legacy hierarchy, we check whether which
* hierarchies are mounted. */
+ mask = 0;
for (c = 0; c < _CGROUP_CONTROLLER_MAX; c++) {
const char *n;