From: Uwe Höhna Date: Fri, 23 Oct 2015 07:35:24 +0000 (+0200) Subject: rrd_parsetime now unlocks its mutex also after parsing errors. X-Git-Tag: v1.6.0~25^2~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f98a7f1579136d31f46f1481ea96b4a1141103e5;p=thirdparty%2Frrdtool-1.x.git rrd_parsetime now unlocks its mutex also after parsing errors. --- diff --git a/src/rrd_parsetime.c b/src/rrd_parsetime.c index 9e2bd7f7..b9f2c212 100644 --- a/src/rrd_parsetime.c +++ b/src/rrd_parsetime.c @@ -832,16 +832,28 @@ static char *day( static mutex_t parsetime_mutex = MUTEX_INITIALIZER; +static char *rrd_parsetime_nomt( + const char *tspec, + rrd_time_value_t * ptv); + char *rrd_parsetime( const char *tspec, rrd_time_value_t * ptv) { - time_t now = time(NULL); - int hr = 0; - /* yes this code is non re-entrant ... so lets make sure we do not run in twice */ mutex_lock(&parsetime_mutex); + char *result = rrd_parsetime_nomt(tspec, ptv); + mutex_unlock(&parsetime_mutex); + return result; +} + +static char *rrd_parsetime_nomt( + const char *tspec, + rrd_time_value_t * ptv) +{ + time_t now = time(NULL); + int hr = 0; /* this MUST be initialized to zero for midnight/noon/teatime */