[rrd-developers] [PATCH] rrdc_flush_if_daemon should not clobber error message
kevin brintnall
kbrint at rufus.net
Fri Oct 17 05:17:52 CEST 2008
Sebastian, I like your suggestion better. Tobi, this patch supercedes my
previous submission.
-----------------------------------------------------------------
In rrdc_flush_if_daemon(), avoid overwriting an error message set by
rrdc_flush(). If there is an error but no message, set an error message
corresponding to the return code. Suggestion from Sebastian Harl.
---
diff --git a/src/rrd_client.c b/src/rrd_client.c
index 5583bfe..8e60664 100644
--- a/src/rrd_client.c
+++ b/src/rrd_client.c
@@ -616,11 +616,21 @@ int rrdc_flush_if_daemon (const char *opt_daemon, const char *filename) /* {{{ *
if (rrdc_is_connected(opt_daemon))
{
+ rrd_clear_error();
status = rrdc_flush (filename);
- if (status != 0)
+
+ if (status != 0 && !rrd_test_error())
{
- rrd_set_error ("rrdc_flush (%s) failed with status %i.",
- filename, status);
+ if (status > 0)
+ {
+ rrd_set_error("rrdc_flush (%s) failed: %s",
+ filename, rrd_strerror(status));
+ }
+ else if (status < 0)
+ {
+ rrd_set_error("rrdc_flush (%s) failed with status %i.",
+ filename, status);
+ }
}
} /* if (rrdc_is_connected(..)) */
More information about the rrd-developers
mailing list