[6.0] 308ff5da1 Reference the correct transition in VRT_synth()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon May 25 16:14:07 UTC 2020


commit 308ff5da1152a5c3cb500d676fe15f1a717d5a8f
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue May 12 08:59:50 2020 +0200

    Reference the correct transition in VRT_synth()

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 4893c20df..d0188492e 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -53,23 +53,26 @@ const void * const vrt_magic_string_unset = &vrt_magic_string_unset;
 VCL_VOID
 VRT_synth(VRT_CTX, VCL_INT code, VCL_STRING reason)
 {
+	const char *ret;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	assert(ctx->req != NULL || ctx->bo != NULL);
+
+	ret = ctx->req == NULL ? "error" : "synth";
 	if (code < 0) {
-		VRT_fail(ctx, "return(synth()) status code (%jd) is negative",
-		    (intmax_t)code);
+		VRT_fail(ctx, "return(%s()) status code (%jd) is negative",
+		    ret, (intmax_t)code);
 		return;
 	}
 	if (code > 65535) {
-		VRT_fail(ctx, "return(synth()) status code (%jd) > 65535",
-		    (intmax_t)code);
+		VRT_fail(ctx, "return(%s()) status code (%jd) > 65535",
+		    ret, (intmax_t)code);
 		return;
 	}
 	if ((code % 1000) < 100) {
 		VRT_fail(ctx,
-		    "illegal return(synth()) status code (%jd) (..0##)",
-		    (intmax_t)code);
+		    "illegal return(%s()) status code (%jd) (..0##)",
+		    ret, (intmax_t)code);
 		return;
 	}
 


More information about the varnish-commit mailing list