[master] 992614831 acceptor: Improve error reporting

Nils Goroll nils.goroll at uplex.de
Mon Sep 30 15:53:07 UTC 2024


commit 99261483189d462c4609cc9df0a766fb972028b0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Sep 5 15:32:21 2024 +0200

    acceptor: Improve error reporting
    
    Include the socket name and make the code more readable by using struct members
    instead of av[]

diff --git a/bin/varnishd/acceptor/mgt_acceptor.c b/bin/varnishd/acceptor/mgt_acceptor.c
index 38ba7ac99..11414f1f7 100644
--- a/bin/varnishd/acceptor/mgt_acceptor.c
+++ b/bin/varnishd/acceptor/mgt_acceptor.c
@@ -149,10 +149,14 @@ VCA_Arg(const char *spec)
 	AN(vca);
 	error = vca->open(av + 2, la, &err);
 
-	if (error)
-		ARGV_ERR("Got no socket(s) for %s (%s)\n", av[1], err);
-	else if (VTAILQ_EMPTY(&la->socks))
-		ARGV_ERR("Got no socket(s) for %s\n", av[1]);
+	if (error) {
+		ARGV_ERR("Got no socket(s) for %s=%s (%s)\n",
+		    la->name, la->endpoint, err);
+	}
+	else if (VTAILQ_EMPTY(&la->socks)) {
+		ARGV_ERR("Got no socket(s) for %s=%s\n",
+		    la->name, la->endpoint);
+	}
 	VAV_Free(av);
 }
 
diff --git a/bin/varnishtest/tests/c00121.vtc b/bin/varnishtest/tests/c00121.vtc
index 8aed31ffa..29812c91f 100644
--- a/bin/varnishtest/tests/c00121.vtc
+++ b/bin/varnishtest/tests/c00121.vtc
@@ -87,5 +87,5 @@ varnish v1 -errvcl {Backend path: The empty abstract socket name is not supporte
 	}
 }
 
-shell -err -expect "Error: Got no socket(s) for @ (The empty abstract socket name is not supported)" \
+shell -err -expect "Error: Got no socket(s) for a0=@ (The empty abstract socket name is not supported)" \
 	"varnishd -n ${tmpdir}/v0 -a @ -b None"


More information about the varnish-commit mailing list