cgroup-util: make cg_get_attribute_as_bool() return 0/1 directly
As with getenv_bool() and getxattr_at_bool(), to match our usual style.
This commit is contained in:
@@ -1638,24 +1638,17 @@ int cg_get_attribute_as_uint64(const char *controller, const char *path, const c
|
||||
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) {
|
||||
|
||||
@@ -219,9 +219,7 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user