The function should return an error when (and only when) something goes
wrong.

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

 src/tools/cgsnapshot.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c
index 404d54a..1247488 100644
--- a/src/tools/cgsnapshot.c
+++ b/src/tools/cgsnapshot.c
@@ -626,7 +626,7 @@ static int show_mountpoints(const char *controller)
 static int parse_mountpoints(cont_name_t cont_names[CG_CONTROLLER_MAX],
        const char *program_name)
 {
-       int ret, final_ret;
+       int ret, final_ret = 0;
        void *handle;
        struct controller_data info;
        struct cgroup_mount_point mount;
@@ -660,9 +660,9 @@ static int parse_mountpoints(cont_name_t 
cont_names[CG_CONTROLLER_MAX],
                                cgroup_strerror(ret));
                        return ret;
                }
+               final_ret = ret;
        }
 
-       final_ret = ret;
        cgroup_get_all_controller_end(&handle);
 
        /* process also named hierarchies */
@@ -688,7 +688,7 @@ static int parse_mountpoints(cont_name_t 
cont_names[CG_CONTROLLER_MAX],
 
        /* finish mount section */
        fprintf(of, "}\n\n");
-       return ret;
+       return final_ret;
 }
 
 int main(int argc, char *argv[])


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to