]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
rrd_parsetime now unlocks its mutex also after parsing errors.
authorUwe Höhna <ufo_dd@web.de>
Fri, 23 Oct 2015 07:35:24 +0000 (09:35 +0200)
committerUwe Höhna <ufo_dd@web.de>
Fri, 23 Oct 2015 07:35:24 +0000 (09:35 +0200)
src/rrd_parsetime.c

index 9e2bd7f75cda1b56f8e606815316ef9400a19b16..b9f2c212d63860d94da5029f416dbe4a0744cb27 100644 (file)
@@ -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 */