Reworked the error handling in cgroup_unload_cgroups.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 src/config.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/config.c b/src/config.c
index bed3871..0913ba3 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);


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to