[4.1] 12b384b Improve output on PRIV_TASK/TOP in init/fini.
Lasse Karstensen
lkarsten at varnish-software.com
Tue Jun 14 12:58:07 CEST 2016
commit 12b384ba0a23bcaa6767bf6804db96cb61cfa71f
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date: Thu May 26 12:51:38 2016 +0200
Improve output on PRIV_TASK/TOP in init/fini.
Output a proper error message instead of a more cryptic assert
if the vmod writer does the wrong thing.
Ref: #1811
diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index c499312..fd8215b 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -115,10 +115,11 @@ VRT_priv_task(VRT_CTX, void *vmod_id)
if (ctx->req) {
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
id = (uintptr_t)ctx->req;
- } else {
+ } else if (ctx->bo) {
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
id = (uintptr_t)ctx->bo;
- }
+ } else
+ WRONG("PRIV_TASK is only accessible in client or backend VCL contexts");
return (VRT_priv_dynamic(ctx, id, (uintptr_t)vmod_id));
}
@@ -133,7 +134,8 @@ VRT_priv_top(VRT_CTX, void *vmod_id)
CHECK_OBJ_NOTNULL(ctx->req->top, REQ_MAGIC);
id = (uintptr_t)&ctx->req->top->top;
return (VRT_priv_dynamic(ctx, id, (uintptr_t)vmod_id));
- }
+ } else
+ WRONG("PRIV_TOP is only accessible in client VCL context");
return (NULL);
}
More information about the varnish-commit
mailing list