[experimental-ims] 97ff8c4 Report dlerror if dlopen fails

Geoff Simmons geoff at varnish-cache.org
Wed Aug 31 16:00:15 CEST 2011

commit 97ff8c4b29a01cb5f3e1c0463a326347f109793b
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Fri Aug 5 09:14:23 2011 +0200

    Report dlerror if dlopen fails
    dlopen typically only fails here if the child process does not have
    access to the build directory and the user runs varnishtest as root
    (meaning the child setuids to nobody).  Report the dlerror and give a
    hopefully helpful hint to help diagnose the error.
    Fixes: #959

diff --git a/bin/varnishd/cache_vrt_vmod.c b/bin/varnishd/cache_vrt_vmod.c
index 9844413..4a4d230 100644
--- a/bin/varnishd/cache_vrt_vmod.c
+++ b/bin/varnishd/cache_vrt_vmod.c
@@ -83,7 +83,11 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm, const char *path)
 		REPLACE(v->path, path);
 		v->hdl = dlopen(v->path, RTLD_NOW | RTLD_LOCAL);
-		AN(v->hdl);
+		if (! v->hdl) {
+			char buf[1024];
+			sprintf(buf, "dlopen failed (child process lacks permission?): %.512s", dlerror());
+			VAS_Fail(__func__, __FILE__, __LINE__, buf, 0, 0);
+		}
 		x = dlsym(v->hdl, "Vmod_Name");

More information about the varnish-commit mailing list