From: oetiker Date: Sun, 8 Mar 2009 11:12:41 +0000 (+0000) Subject: rrd_flush.c: Provide a more useful error message. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f4abf7d18767b842801a7c38f922e34e0ff3c890;p=rrdtool.git rrd_flush.c: Provide a more useful error message. by Sebastian Harl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1758 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_flush.c b/src/rrd_flush.c index 2d8df3a..1f72e80 100644 --- a/src/rrd_flush.c +++ b/src/rrd_flush.c @@ -90,7 +90,21 @@ int rrd_cmd_flush (int argc, char **argv) for (int i = optind; i < argc; i++) { status = rrdc_flush(argv[i]); - if (status) break; + if (status) + { + char *error; + int remaining; + + error = strdup(rrd_get_error()); + remaining = argc - optind - 1; + + rrd_set_error("Flushing of file \"%s\" failed: %s. Skipping " + "remaining %i file%s.", argv[i], + ((! error) || (*error == '\0')) ? "unknown error" : error, + remaining, (remaining == 1) ? "" : "s"); + free(error); + break; + } } return ((status == 0) ? 0 : -1);