rrdc_flush_if_daemon should not clobber error message -- kevin (as suggested by Sebas...
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 17 Oct 2008 05:50:22 +0000 (05:50 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 17 Oct 2008 05:50:22 +0000 (05:50 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1618 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_client.c

index 5e22a98..8e60664 100644 (file)
@@ -615,8 +615,25 @@ int rrdc_flush_if_daemon (const char *opt_daemon, const char *filename) /* {{{ *
   rrdc_connect(opt_daemon);
 
   if (rrdc_is_connected(opt_daemon))
+  {
+    rrd_clear_error();
     status = rrdc_flush (filename);
 
+    if (status != 0 && !rrd_test_error())
+    {
+      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(..)) */
+
   return status;
 } /* }}} int rrdc_flush_if_daemon */