Tobi,

I didn't notice that you'd already applied my earlier patch into /trunk.
This one should apply cleanly on top.

Thanks.

-----------------------------------------------------------------

failure in rrdc_flush_if_daemon  will rrd_set_error() if necessary

Suggestion from Sebastian Harl.  If the client already set an error
message, it is preserved.  Otherwise, add a message corresponding to the
return code from rrdc_flush.

---
diff --git a/src/rrd_client.c b/src/rrd_client.c
index 5e22a98..8e60664 100644
--- a/src/rrd_client.c
+++ b/src/rrd_client.c
@@ -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 */
 

_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to