]> mj.ucw.cz Git - arexx.git/commitdiff
Clear all librrd errors by calling rrd_clear_error()
authorMartin Mares <mj@ucw.cz>
Sat, 3 Mar 2012 17:35:26 +0000 (18:35 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 3 Mar 2012 17:35:26 +0000 (18:35 +0100)
Otherwise, the library can get confused by earlier errors.

arexxd.c

index 8cbd56752ab35367780840e1a9cf1f0ebd6f54f9..0358db145ba9d1d36953c9123f7f71c61918a486 100644 (file)
--- a/arexxd.c
+++ b/arexxd.c
@@ -141,6 +141,7 @@ static void rrd_point(time_t t, const char *name, double val, char *unit)
                rrd_create(arg_cnt, arg_ptr);
                if (rrd_test_error()) {
                        log_error("rrd_create on %s failed: %s", rr_name, rrd_get_error());
+                       rrd_clear_error();
                        return;
                }
        }
@@ -149,8 +150,10 @@ static void rrd_point(time_t t, const char *name, double val, char *unit)
        arg_push(rr_name);
        arg_push("%d:%f", t, val);
        rrd_update(arg_cnt, arg_ptr);
-       if (rrd_test_error())
+       if (rrd_test_error()) {
                log_error("rrd_update on %s failed: %s", rr_name, rrd_get_error());
+               rrd_clear_error();
+       }
 }
 
 /*** Transforms ***/