Commit ca5859d1 authored by Tollef Fog Heen's avatar Tollef Fog Heen

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
parent b7938755
......@@ -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");
AN(x);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment