]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: assert on attribute for cg_{get,set}_attribute() 37630/head
authorMike Yuan <me@yhndnzj.com>
Tue, 27 May 2025 12:25:12 +0000 (14:25 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 27 May 2025 12:31:06 +0000 (14:31 +0200)
It makes zero sense to ever perform IO operations on cgroup dirs.

src/basic/cgroup-util.c

index c70b04650c12981453498df977671fefdad59dbd..f3ce17424486de6eb122eb6a07d12fe92970adf0 100644 (file)
@@ -1594,6 +1594,8 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
         _cleanup_free_ char *p = NULL;
         int r;
 
+        assert(attribute);
+
         r = cg_get_path(controller, path, attribute, &p);
         if (r < 0)
                 return r;
@@ -1605,6 +1607,8 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri
         _cleanup_free_ char *p = NULL;
         int r;
 
+        assert(attribute);
+
         r = cg_get_path(controller, path, attribute, &p);
         if (r < 0)
                 return r;