[master] 50fb96898 VTCP_listen() may actually return file descriptor 0

Nils Goroll nils.goroll at uplex.de
Tue Jun 29 15:06:08 UTC 2021


commit 50fb968980d66e40385e3828248ea663af7c55e6
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jun 29 17:01:43 2021 +0200

    VTCP_listen() may actually return file descriptor 0
    
    There are more assertions on sockets not use file descriptor 0, but
    not being aware of any examples of those being actually hit, I prefer
    a minimal fix.
    
    Fixes #3636

diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index d5afe460c..85521b8c9 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -518,7 +518,7 @@ vtcp_lo_cb(void *priv, const struct suckaddr *sa)
 	struct helper *hp = priv;
 
 	sock = VTCP_listen(sa, hp->depth, hp->errp);
-	if (sock > 0) {
+	if (sock >= 0) {
 		*hp->errp = NULL;
 		return (sock);
 	}


More information about the varnish-commit mailing list