prepare for the release of rrdtool-1.2.19
[rrdtool.git] / src / rrd_thread_safe.c
index 223b586..2ce649b 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.1.x  Copyright Tobias Oetiker, 1997 - 2002
+ * RRDtool 1.2.19  Copyright by Tobi Oetiker, 1997-2007
  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
  *                             & Tobias Oetiker
  * Distributed under the GPL
@@ -11,7 +11,7 @@
 
 #include <pthread.h>
 #include <string.h>
-#include <error.h>
+/* #include <error.h> */
 #include "rrd.h"
 #include "rrd_tool.h"
 
@@ -54,12 +54,14 @@ const char *rrd_strerror(int err) {
     return strerror_r(err, ctx->lib_errstr, ctx->errlen);
 }
 #else
+#undef strerror
 const char *rrd_strerror(int err) {
     static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
     struct rrd_context *ctx;
     ctx = rrd_get_context();
     pthread_mutex_lock(&mtx);
     strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
+    ctx->lib_errstr[ctx->errlen]='\0';
     pthread_mutex_unlock(&mtx);
     return ctx->lib_errstr;
 }