[master] 30eb7db8b Pthread_create() acutally doesnt set errno as we expect.

Poul-Henning Kamp phk at FreeBSD.org
Mon Feb 22 13:27:07 UTC 2021


commit 30eb7db8b87d9db42b3b99b0bb14e9b8a8ffaedf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 22 13:14:14 2021 +0000

    Pthread_create() acutally doesnt set errno as we expect.
    
    Spotted by: Rasmus Villemoes

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index bd89940b7..dcedcd344 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -528,7 +528,8 @@ pool_breed(struct pool *qp)
 	AZ(pthread_attr_getstacksize(&tp_attr, &pi->stacksize));
 	pi->qp = qp;
 
-	if (pthread_create(&tp, &tp_attr, pool_thread, pi)) {
+	errno = pthread_create(&tp, &tp_attr, pool_thread, pi);
+	if (errno) {
 		FREE_OBJ(pi);
 		VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
 		    errno, vstrerror(errno));


More information about the varnish-commit mailing list