From a704716c242d4f74bfe1639724ff19e9c0fd0468 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 8 Mar 2009 11:12:41 +0000 Subject: [PATCH] rrd_flush.c: Provide a more useful error message. by Sebastian Harl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1758 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_flush.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/program/src/rrd_flush.c b/program/src/rrd_flush.c index 2d8df3ae..1f72e800 100644 --- a/program/src/rrd_flush.c +++ b/program/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); -- 2.30.2