src/utils_rrdcreate.c: Fix support for non-threadsafe libraries.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 22 Jan 2009 09:08:48 +0000 (10:08 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 22 Jan 2009 09:08:48 +0000 (10:08 +0100)
src/utils_rrdcreate.c

index 8ff025b..f006d13 100644 (file)
@@ -23,6 +23,7 @@
 #include "common.h"
 #include "utils_rrdcreate.h"
 
+#include <pthread.h>
 #include <rrd.h>
 
 /*
@@ -46,6 +47,10 @@ static char *rra_types[] =
 };
 static int rra_types_num = STATIC_ARRAY_SIZE (rra_types);
 
+#if !defined(HAVE_THREADSAFE_LIBRRD) || !HAVE_THREADSAFE_LIBRRD
+static pthread_mutex_t librrd_lock = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
 /*
  * Private functions
  */
@@ -314,7 +319,7 @@ static int srrd_create (const char *filename, /* {{{ */
   ssnprintf (last_up_str, sizeof (last_up_str), "%u", (unsigned int) last_up);
 
   new_argv[0] = "create";
-  new_argv[1] = filename;
+  new_argv[1] = (void *) filename;
   new_argv[2] = "-s";
   new_argv[3] = pdp_step_str;
   new_argv[4] = "-b";