]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgclear: Simplified error handling when unmounting controllers
authorJan Safranek <jsafrane@redhat.com>
Wed, 24 Aug 2011 09:46:08 +0000 (11:46 +0200)
committerJan Safranek <jsafrane@redhat.com>
Mon, 19 Sep 2011 11:27:38 +0000 (13:27 +0200)
Reworked the error handling in cgroup_unload_cgroups.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
src/config.c

index bed387147d401baeeb1db99cf790d67ab98f1f19..0913ba3f207ab843e8bbe3e3d94d4cca494f5825 100644 (file)
@@ -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);