[master] 757992390 Fix privs panic formatting

Nils Goroll nils.goroll at uplex.de
Sat Jan 23 13:44:07 UTC 2021


commit 7579923908dfadac459ef5a0dc09f510655b265e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Jan 23 14:10:00 2021 +0100

    Fix privs panic formatting
    
    55dffc3585685f2a67e3228094aea9ca9d986798 introduced a PAN_dump_struct()
    call, which implies printing '{' and VSB_indent(vsb, 2). Fix missing '}'
    and wrong indentation.
    
    Also remove redundant "priv" output, which now happens in PAN_dump_struct()
    
    Diff best viewed ignoring whitespace (-b option).

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 40434dc6e..1cd4898c3 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -77,17 +77,19 @@ pan_privs(struct vsb *vsb, const struct vrt_privs *privs)
 		//lint -e{774}
 		if (p == NULL) {
 			// should never happen
-			VSB_printf(vsb, "priv NULL vmod %jx\n",
+			VSB_printf(vsb, "NULL vmod %jx\n",
 			    (uintmax_t)vp->vmod_id);
-			continue;
+		} else {
+			m = p->methods;
+			VSB_printf(vsb,
+			    "{p %p l %ld m %p t \"%s\"} vmod %jx\n",
+			    p->priv, p->len, m,
+			    m != NULL ? m->type : "",
+			    (uintmax_t)vp->vmod_id
+			);
 		}
-		m = p->methods;
-		VSB_printf(vsb,
-		    "priv {p %p l %ld m %p t \"%s\"} vmod %jx\n",
-		    p->priv, p->len, m,
-		    m != NULL ? m->type : "",
-		    (uintmax_t)vp->vmod_id
-		);
+		VSB_indent(vsb, -2);
+		VSB_cat(vsb, "},\n");
 	}
 	VSB_indent(vsb, -2);
 	VSB_cat(vsb, "},\n");


More information about the varnish-commit mailing list