From: oetiker Date: Sat, 16 Dec 2006 16:10:58 +0000 (+0000) Subject: init the context on first call X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=660d96cfab5d8b98a46094fac0b43168cd158a2f;p=rrdtool-all.git init the context on first call git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@935 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_not_thread_safe.c b/program/src/rrd_not_thread_safe.c index 70222770..7b6a2565 100644 --- a/program/src/rrd_not_thread_safe.c +++ b/program/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; }