[master] 5b515149f cache_vcl: Better dlopen error reporting

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jun 3 10:56:05 UTC 2024


commit 5b515149fd67cdf9d8a3d81c16ab1bf7d13d71e0
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed May 22 19:42:42 2024 +0200

    cache_vcl: Better dlopen error reporting

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 90e41ece8..10cb70f8f 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -474,6 +474,8 @@ VCL_Open(const char *fn, struct vsb *msg)
 	struct vcl *vcl;
 	void *dlh;
 	struct VCL_conf const *cnf;
+	const char *dlerr;
+	int err;
 
 	AN(fn);
 	AN(msg);
@@ -485,8 +487,15 @@ VCL_Open(const char *fn, struct vsb *msg)
 #endif
 	dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
 	if (dlh == NULL) {
+		err = errno;
+		dlerr = dlerror();
 		VSB_cat(msg, "Could not load compiled VCL.\n");
-		VSB_printf(msg, "\tdlopen() = %s\n", dlerror());
+		if (dlerr != NULL)
+			VSB_printf(msg, "\tdlopen() = %s\n", dlerr);
+		if (err) {
+			VSB_printf(msg, "\terror = %s (%d)\n",
+			    strerror(err), err);
+		}
 		VSB_cat(msg, "\thint: check for \"noexec\" mount\n");
 		return (NULL);
 	}


More information about the varnish-commit mailing list