return 0;
}
-int cg_get_attribute_as_bool(const char *controller, const char *path, const char *attribute, bool *ret) {
+int cg_get_attribute_as_bool(const char *controller, const char *path, const char *attribute) {
_cleanup_free_ char *value = NULL;
int r;
- assert(ret);
-
r = cg_get_attribute(controller, path, attribute, &value);
if (r == -ENOENT)
return -ENODATA;
if (r < 0)
return r;
- r = parse_boolean(value);
- if (r < 0)
- return r;
-
- *ret = r;
- return 0;
+ return parse_boolean(value);
}
int cg_get_owner(const char *path, uid_t *ret_uid) {
int cg_get_keyed_attribute(const char *controller, const char *path, const char *attribute, char * const *keys, char **values);
int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uint64_t *ret);
-
-/* Does a parse_boolean() on the attribute contents and sets ret accordingly */
-int cg_get_attribute_as_bool(const char *controller, const char *path, const char *attribute, bool *ret);
+int cg_get_attribute_as_bool(const char *controller, const char *path, const char *attribute);
int cg_get_owner(const char *path, uid_t *ret_uid);
do {
_cleanup_free_ char *cg_path = NULL;
- bool oom_group;
cg_path = path_join(empty_to_root(path), subpath);
if (!cg_path)
subpath = mfree(subpath);
- r = cg_get_attribute_as_bool("memory", cg_path, "memory.oom.group", &oom_group);
+ r = cg_get_attribute_as_bool("memory", cg_path, "memory.oom.group");
/* The cgroup might be gone. Skip it as a candidate since we can't get information on it. */
if (r == -ENOMEM)
return r;
log_debug_errno(r, "Failed to read memory.oom.group from %s, ignoring: %m", cg_path);
return 0;
}
-
- if (oom_group)
+ if (r > 0)
r = oomd_insert_cgroup_context(NULL, new_h, cg_path);
else
r = recursively_get_cgroup_context(new_h, cg_path);