[master] 47d11712e mgt_util: Do not clear the VSB in MGT_ComplainVSB

Nils Goroll nils.goroll at uplex.de
Fri Feb 14 09:23:06 UTC 2025


commit 47d11712e819312e6715687923fa1719cc547cba
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Feb 14 10:19:46 2025 +0100

    mgt_util: Do not clear the VSB in MGT_ComplainVSB
    
    Clearing out the VSB was not a good idea, the panic code keeps the vsb around.
    
    Sorry to everyone, and I missed to re-run make check...
    
    Fixup to 9056935ef6420cc299cc897146c0256385cc3550

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index ed955acdb..933a9d93a 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -901,6 +901,7 @@ main(int argc, char * const *argv)
 	AZ(system("rm -rf vmod_cache vext_cache worker_tmpdir"));
 	VJ_master(JAIL_MASTER_LOW);
 
+	VSB_clear(vsb);
 	o = VJ_make_subdir("vmod_cache", "VMOD cache", vsb) ||
 	    VJ_make_subdir("worker_tmpdir",
 		"TMPDIR for the worker process", vsb) ||
diff --git a/bin/varnishd/mgt/mgt_util.c b/bin/varnishd/mgt/mgt_util.c
index 7e985d30d..6ccf67cee 100644
--- a/bin/varnishd/mgt/mgt_util.c
+++ b/bin/varnishd/mgt/mgt_util.c
@@ -148,13 +148,11 @@ MGT_ComplainVSB(const char *loud, struct vsb *vsb)
 {
 	int sf;
 
+	AZ(VSB_finish(vsb));
+
 	if (VSB_len(vsb) == 0 ||
-	    (loud == C_CLI && !mgt_param.syslog_cli_traffic)) {
-		VSB_clear(vsb);
+	    (loud == C_CLI && !mgt_param.syslog_cli_traffic))
 		return;
-	}
-
-	AZ(VSB_finish(vsb));
 
 	if (loud == C_ERR)
 		sf = LOG_ERR;
@@ -174,7 +172,6 @@ MGT_ComplainVSB(const char *loud, struct vsb *vsb)
 
 	if (!MGT_DO_DEBUG(DBG_VTC_MODE))
 		syslog(sf, "%s", VSB_data(vsb));
-	VSB_clear(vsb);
 }
 
 void


More information about the varnish-commit mailing list