Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
if (r)
return r;
+ // Delete the directory
+ r = unlinkat(cgroup->parent->fd, cgroup->name, AT_REMOVEDIR);
+ if (r) {
+ ERROR(cgroup->ctx, "Could not destroy cgroup %s: %m\n", cgroup->path);
+ return -errno;
+ }
+
// Close the file descriptor
if (cgroup->fd >= 0) {
close(cgroup->fd);
cgroup->fd = -EBADF;
}
- // Delete the directory
- r = unlinkat(cgroup->parent->fd, cgroup->name, AT_REMOVEDIR);
- if (r)
- ERROR(cgroup->ctx, "Could not destroy cgroup: %m\n");
-
return r;
}