From: Michael Tremer Date: Sat, 14 Dec 2024 13:23:40 +0000 (+0000) Subject: cgroups: Remove function to recursively create cgroups X-Git-Tag: 0.9.30~726 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2a98964d785b32601735766206adde30dd5f755;p=pakfire.git cgroups: Remove function to recursively create cgroups Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/cgroup.c b/src/libpakfire/cgroup.c index 406c8228c..a31dc1b54 100644 --- a/src/libpakfire/cgroup.c +++ b/src/libpakfire/cgroup.c @@ -462,46 +462,6 @@ ERROR: return r; } -static int pakfire_cgroup_create_recursive(struct pakfire_cgroup** cgroup, - struct pakfire_ctx* ctx, struct pakfire_cgroup* parent, const char* path, int flags) { - struct pakfire_cgroup* child = NULL; - char buffer[PATH_MAX]; - char* name = NULL; - char* p = NULL; - int r; - - // Copy the path to the buffer - r = pakfire_string_set(buffer, path); - if (r < 0) - goto ERROR; - - // Split the path by / - name = strtok_r(buffer, "/", &p); - - // Walk through all elements of the path - while (name) { - r = pakfire_cgroup_open(&child, parent->ctx, parent, name, flags); - if (r < 0) - goto ERROR; - - // Move on to the next round... - pakfire_cgroup_unref(parent); - parent = child; child = NULL; - - name = strtok_r(NULL, "/", &p); - } - - // Return the pointer - *cgroup = pakfire_cgroup_ref(parent); - -ERROR: - // XXX We may free the passed parent here if we did zero iterations of the while loop - if (parent) - pakfire_cgroup_unref(parent); - - return r; -} - int pakfire_cgroup_create(struct pakfire_cgroup** cgroup, struct pakfire_ctx* ctx, struct pakfire_cgroup* parent, const char* name, int flags) { struct pakfire_cgroup* root = NULL; @@ -517,7 +477,6 @@ int pakfire_cgroup_create(struct pakfire_cgroup** cgroup, } // Recursively create the new cgroup - //r = pakfire_cgroup_create_recursive(cgroup, ctx, parent, name, flags); r = pakfire_cgroup_open(cgroup, ctx, parent, name, flags); // Cleanup