From e3bfa9395d146d29e0753d2485de8c85c302a98e Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Mon, 14 Feb 2022 08:11:25 -0700 Subject: [PATCH] api: make cgroup_get_subsys_mount_point_end() more useful Currently cgroup_get_subsys_mount_point_end(), does nothing more than returning zero, it was caught by LGTM altering: "This expression has no effect (because cgroup_get_subsys_mount_point_end has no external side effects)." make the function more useful like other *_end() functions by including the check for cgroup_initialized and assigning NULL to the handle used for iterating over controller mount points. Reported-by: LGTM Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- src/api.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api.c b/src/api.c index 8f3a4042..4e3fe470 100644 --- a/src/api.c +++ b/src/api.c @@ -5789,6 +5789,12 @@ int cgroup_get_subsys_mount_point_next(void **handle, int cgroup_get_subsys_mount_point_end(void **handle) { + if (!cgroup_initialized) + return ECGROUPNOTINITIALIZED; + if (!handle) + return ECGINVAL; + + *handle = NULL; return 0; } -- 2.47.2