Mailing List Archive

[master] 93047d4fa Take mutexes for sake of consistency (Coverity)
commit 93047d4fa0544edf181413d64dffcdffdb31125e
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon Jan 15 08:52:09 2024 +0000

Take mutexes for sake of consistency (Coverity)

diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index 5bbe4f858..d44dc4f27 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -1067,7 +1067,9 @@ cmd_process(CMD_ARGS)
p = process_new(av[0]);
av++;

+ PTOK(pthread_mutex_lock(&p->mtx));
bsnap = p->stdout_bytes;
+ PTOK(pthread_mutex_unlock(&p->mtx));

for (; *av != NULL; av++) {
if (vtc_error)
diff --git a/vmod/vmod_debug_dyn.c b/vmod/vmod_debug_dyn.c
index f557e075c..4714c436b 100644
--- a/vmod/vmod_debug_dyn.c
+++ b/vmod/vmod_debug_dyn.c
@@ -155,10 +155,14 @@ xyzzy_dyn__fini(struct xyzzy_debug_dyn **dynp)
VCL_BACKEND v_matchproto_()
xyzzy_dyn_backend(VRT_CTX, struct xyzzy_debug_dyn *dyn)
{
+ VCL_BACKEND retval;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC);
- AN(dyn->dir);
- return (dyn->dir);
+ PTOK(pthread_mutex_lock(&dyn->mtx));
+ retval = dyn->dir;
+ PTOK(pthread_mutex_unlock(&dyn->mtx));
+ AN(retval);
+ return (retval);
}

VCL_VOID
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit