projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- rrd_open() calculates file size for new files and calls mmap once for
[rrdtool.git]
/
src
/
rrd_thread_safe.c
diff --git
a/src/rrd_thread_safe.c
b/src/rrd_thread_safe.c
index
5ef978b
..
c910b98
100644
(file)
--- a/
src/rrd_thread_safe.c
+++ b/
src/rrd_thread_safe.c
@@
-1,5
+1,5
@@
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.3
rc7
Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3
.2
Copyright by Tobi Oetiker, 1997-2008
* 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
@@
-27,7
+27,7
@@
static pthread_once_t context_key_once = PTHREAD_ONCE_INIT;
static void context_destroy_context(
void *ctx_)
{
static void context_destroy_context(
void *ctx_)
{
-
struct rrd_contex
t *ctx = ctx_;
+
rrd_context_
t *ctx = ctx_;
if (ctx)
rrd_free_context(ctx);
if (ctx)
rrd_free_context(ctx);
@@
-40,10
+40,10
@@
static void context_get_key(
pthread_key_create(&context_key, context_destroy_context);
}
pthread_key_create(&context_key, context_destroy_context);
}
-
struct rrd_contex
t *rrd_get_context(
+
rrd_context_
t *rrd_get_context(
void)
{
void)
{
-
struct rrd_contex
t *ctx;
+
rrd_context_
t *ctx;
pthread_once(&context_key_once, context_get_key);
ctx = pthread_getspecific(context_key);
pthread_once(&context_key_once, context_get_key);
ctx = pthread_getspecific(context_key);
@@
-58,9
+58,9
@@
struct rrd_context *rrd_get_context(
const char *rrd_strerror(
int err)
{
const char *rrd_strerror(
int err)
{
-
struct rrd_contex
t *ctx = rrd_get_context();
+
rrd_context_
t *ctx = rrd_get_context();
- if (strerror_r(err, ctx->lib_errstr,
ctx->errlen
))
+ if (strerror_r(err, ctx->lib_errstr,
sizeof(ctx->lib_errstr)
))
return "strerror_r failed. sorry!";
else
return ctx->lib_errstr;
return "strerror_r failed. sorry!";
else
return ctx->lib_errstr;
@@
-71,12
+71,12
@@
const char *rrd_strerror(
int err)
{
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
int err)
{
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-
struct rrd_contex
t *ctx;
+
rrd_context_
t *ctx;
ctx = rrd_get_context();
pthread_mutex_lock(&mtx);
ctx = rrd_get_context();
pthread_mutex_lock(&mtx);
- strncpy(ctx->lib_errstr, strerror(err),
ctx->errlen
);
- ctx->lib_errstr[
ctx->errlen
] = '\0';
+ strncpy(ctx->lib_errstr, strerror(err),
sizeof(ctx->lib_errstr)
);
+ ctx->lib_errstr[
sizeof(ctx->lib_errstr) - 1
] = '\0';
pthread_mutex_unlock(&mtx);
return ctx->lib_errstr;
}
pthread_mutex_unlock(&mtx);
return ctx->lib_errstr;
}