From 8c8100e5081f51c6fe8cb2e1dd187fe8376aa1cb Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 16 Dec 2006 16:10:58 +0000 Subject: [PATCH] init the context on first call git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@935 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_not_thread_safe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rrd_not_thread_safe.c b/src/rrd_not_thread_safe.c index 7022277..7b6a256 100644 --- a/src/rrd_not_thread_safe.c +++ b/src/rrd_not_thread_safe.c @@ -16,6 +16,7 @@ static char rrd_error[MAXLEN+10]; static char rrd_liberror[ERRBUFLEN+10]; +static int rrd_context_init = 0; /* The global context is very useful in the transition period to even more thread-safe stuff, it can be used whereever we need a context and do not need to worry about concurrency. */ @@ -28,6 +29,11 @@ static struct rrd_context global_ctx = { /* #include */ struct rrd_context *rrd_get_context(void) { + if (! rrd_context_init ){ + rrd_context_init = 1; + global_ctx.rrd_error[0]='\0'; + global_ctx.lib_errstr[0]='\0'; + } return &global_ctx; } -- 2.30.2