[master] f855fa46f varnishtest: Bandaid for an uninitialized mutex

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Jan 12 21:20:10 UTC 2021


commit f855fa46fb1ad66f16e264d57129d605e87f33c4
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Jan 12 22:15:49 2021 +0100

    varnishtest: Bandaid for an uninitialized mutex

diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index d1a14cf8c..d22e36037 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -139,9 +139,12 @@ extmacro_def(const char *name, const char *fmt, ...)
 
 /**********************************************************************
  * Below this point is run inside the testing child-process.
+ *
+ * XXX: This is no longer the case for macro_get() that is currently
+ * used in the main process.
  */
 
-static pthread_mutex_t		macro_mtx;
+static pthread_mutex_t macro_mtx = PTHREAD_MUTEX_INITIALIZER;
 
 static void
 init_macro(void)
@@ -151,8 +154,6 @@ init_macro(void)
 	/* Dump the extmacros for completeness */
 	VTAILQ_FOREACH(m, &macro_list, list)
 		vtc_log(vltop, 4, "extmacro def %s=%s", m->name, m->val);
-
-	AZ(pthread_mutex_init(&macro_mtx, NULL));
 }
 
 void


More information about the varnish-commit mailing list