When parse_mountpoints() fails, the error is not propagated to final cgsnapshot exit code. Also free black&white lists on error.
Changelog: - remove whitespace changes Signed-off-by: Jan Safranek <jsafr...@redhat.com> --- src/tools/cgsnapshot.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c index 1247488..7359779 100644 --- a/src/tools/cgsnapshot.c +++ b/src/tools/cgsnapshot.c @@ -693,7 +693,7 @@ static int parse_mountpoints(cont_name_t cont_names[CG_CONTROLLER_MAX], int main(int argc, char *argv[]) { - int ret = 0; + int ret = 0, err; int c; int i; @@ -777,31 +777,34 @@ int main(int argc, char *argv[]) ret = load_list(BLACKLIST_CONF, &black_list); } if (ret != 0) - return ret; + goto finish; /* whitelist */ if (flags & FL_WHITE) ret = load_list(wl_file, &white_list); if (ret != 0) - return ret; + goto finish; /* print the header */ fprintf(of, "# Configuration file generated by cgsnapshot\n"); /* initialize libcgroup */ ret = cgroup_init(); - - if (ret) { + if (ret) /* empty configuration file */ - return ret; - } + goto finish; /* print mount points section */ ret = parse_mountpoints(wanted_cont, argv[0]); + /* continue with processing on error*/ /* print hierarchies section */ - ret = parse_controllers(wanted_cont, argv[0]); + /*replace error from parse_mountpoints() only with another error*/ + err = parse_controllers(wanted_cont, argv[0]); + if (err) + ret = err; +finish: free_list(black_list); free_list(white_list); ------------------------------------------------------------------------------ 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