[master] 9d790ec Also lock the to-fd
Poul-Henning Kamp
phk at FreeBSD.org
Sun Jan 15 19:47:04 CET 2017
commit 9d790ec30df404a8589cbfc189e51bdc6f9403ce
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Jan 15 18:42:19 2017 +0000
Also lock the to-fd
diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index ac6d4a3..5e77936 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -178,10 +178,12 @@ process_thread(void *priv)
}
r = wait4(p->pid, &p->status, 0, &ru);
- closefd(&p->fd_to);
AZ(pthread_mutex_lock(&p->mtx));
+ if (p->fd_to >= 0)
+ closefd(&p->fd_to);
+
macro_undef(p->vl, p->name, "pid");
p->pid = -1;
@@ -361,7 +363,10 @@ process_close(struct process *p)
if (!p->hasthread)
vtc_log(p->vl, 0, "Cannot close on a non-running process");
- closefd(&p->fd_to);
+ AZ(pthread_mutex_lock(&p->mtx));
+ if (p->fd_to >= 0)
+ closefd(&p->fd_to);
+ AZ(pthread_mutex_unlock(&p->mtx));
}
/* SECTION: process process
More information about the varnish-commit
mailing list