projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
profile must be in the source directory to work
[rrdtool.git]
/
src
/
rrd_thread_safe.c
diff --git
a/src/rrd_thread_safe.c
b/src/rrd_thread_safe.c
index
b559063
..
4714327
100644
(file)
--- a/
src/rrd_thread_safe.c
+++ b/
src/rrd_thread_safe.c
@@
-1,5
+1,5
@@
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.2
rc2 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2
.23 Copyright by Tobi Oetiker, 1997-2007
* This file: Copyright 2003 Peter Stamfest <peter@stamfest.at>
* & Tobias Oetiker
* Distributed under the GPL
* This file: Copyright 2003 Peter Stamfest <peter@stamfest.at>
* & Tobias Oetiker
* Distributed under the GPL
@@
-51,7
+51,10
@@
struct rrd_context *rrd_get_context(void) {
#ifdef HAVE_STRERROR_R
const char *rrd_strerror(int err) {
struct rrd_context *ctx = rrd_get_context();
#ifdef HAVE_STRERROR_R
const char *rrd_strerror(int err) {
struct rrd_context *ctx = rrd_get_context();
- return strerror_r(err, ctx->lib_errstr, ctx->errlen);
+ if (strerror_r(err, ctx->lib_errstr, ctx->errlen))
+ return "strerror_r failed. sorry!";
+ else
+ return ctx->lib_errstr;
}
#else
#undef strerror
}
#else
#undef strerror
@@
-61,6
+64,7
@@
const char *rrd_strerror(int err) {
ctx = rrd_get_context();
pthread_mutex_lock(&mtx);
strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
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;
}
pthread_mutex_unlock(&mtx);
return ctx->lib_errstr;
}