Code

rrdtool plugin: Make sure the initialization is run only once.
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 18 May 2009 12:42:39 +0000 (14:42 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 18 May 2009 12:42:39 +0000 (14:42 +0200)
Thanks to Amit Gupta for reporting this bug!

src/rrdtool.c

index bbebc375ffd1899a3d2b727817ade097e60d093a..a205ef2ce2ff0465360df9a00d99fa9a0b5e0abc 100644 (file)
@@ -1007,8 +1007,13 @@ static int rrd_shutdown (void)
 
 static int rrd_init (void)
 {
+       static int init_once = 0;
        int status;
 
+       if (init_once != 0)
+               return (0);
+       init_once = 1;
+
        if (rrdcreate_config.stepsize < 0)
                rrdcreate_config.stepsize = 0;
        if (rrdcreate_config.heartbeat <= 0)