From: Jan Safranek Date: Wed, 24 Aug 2011 09:46:08 +0000 (+0200) Subject: cgclear: Simplified error handling when unmounting controllers X-Git-Tag: v0.38~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6be07ae10161ce4fbb28025186b2ce14c65d7825;p=thirdparty%2Flibcgroup.git cgclear: Simplified error handling when unmounting controllers Reworked the error handling in cgroup_unload_cgroups. Signed-off-by: Jan Safranek --- diff --git a/src/config.c b/src/config.c index bed38714..0913ba3f 100644 --- a/src/config.c +++ b/src/config.c @@ -885,12 +885,7 @@ int cgroup_unload_cgroups(void) } error = cgroup_get_controller_begin(&ctrl_handle, &info); - if (error && error != ECGEOF) { - ret = error; - goto out_error; - } - - while (error != ECGEOF) { + while (error == 0) { if (!curr_path || strcmp(info.path, curr_path) != 0) { if (curr_path) free(curr_path); @@ -909,13 +904,11 @@ int cgroup_unload_cgroups(void) } error = cgroup_get_controller_next(&ctrl_handle, &info); - - if (error && error != ECGEOF) { - ret = error; - goto out_error; - } } - + if (error == ECGEOF) + error = 0; + if (error) + ret = error; out_error: if (curr_path) free(curr_path);