_cleanup_free_ char *fs = NULL;
int r;
+ r = cg_get_path(controller, NULL, "notify_on_release", &fs);
+ if (r < 0)
+ return r;
+
+ r = write_string_file(fs, "0");
+ if (r < 0)
+ return r;
+
+ free(fs);
+ fs = NULL;
+
r = cg_get_path(controller, NULL, "release_agent", &fs);
if (r < 0)
return r;
if (r < 0)
return r;
- return 0;
+ return 0;
}
int cg_is_empty(const char *controller, const char *path, bool ignore_self) {
}
int cg_path_decode_unit(const char *cgroup, char **unit){
- char *p, *e, *c, *s, *k;
+ char *e, *c, *s;
assert(cgroup);
assert(unit);
c = strndupa(cgroup, e - cgroup);
c = cg_unescape(c);
- /* Could this be a valid unit name? */
- if (!unit_name_is_valid(c, true))
+ if (!unit_name_is_valid(c, false))
return -EINVAL;
- if (!unit_name_is_template(c))
- s = strdup(c);
- else {
- if (*e != '/')
- return -EINVAL;
-
- e += strspn(e, "/");
-
- p = strchrnul(e, '/');
- k = strndupa(e, p - e);
- k = cg_unescape(k);
-
- if (!unit_name_is_valid(k, false))
- return -EINVAL;
-
- s = strdup(k);
- }
-
+ s = strdup(c);
if (!s)
return -ENOMEM;