]> git.ipfire.org Git - pakfire.git/commitdiff
cgroups: Remove function to recursively create cgroups
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 13:23:40 +0000 (13:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 13:23:40 +0000 (13:23 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/cgroup.c

index 406c8228cc462563a4ecf55eca5386ba9dbc797b..a31dc1b5486ef00b7f67fa1a7ce73a4532d38f7c 100644 (file)
@@ -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