From: Kamalesh Babulal Date: Mon, 14 Feb 2022 15:11:25 +0000 (-0700) Subject: api: make cgroup_get_subsys_mount_point_end() more useful X-Git-Tag: v3.0~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3bfa9395d146d29e0753d2485de8c85c302a98e;p=thirdparty%2Flibcgroup.git 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 --- 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; }