Commit 20ee7417 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

After compilation of a VCL program, do a test-load into the management

process to catch any implementation-discrepancies between symbols used
by the compiler and those implemented in the runtime.

The situation will happen from time to time and there is no need to
issue a panic when we can test sensibly for it.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1394 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent dd09e330
......@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -59,7 +60,6 @@ struct vclprog {
int active;
};
static TAILQ_HEAD(, vclprog) vclhead = TAILQ_HEAD_INITIALIZER(vclhead);
/*--------------------------------------------------------------------*/
......@@ -129,6 +129,7 @@ mgt_CallCc(const char *source, struct vsb *sb)
FILE *fo, *fs;
char *of, *sf, buf[BUFSIZ];
int i, j, sfd;
void *p;
/* Create temporary C source file */
sf = strdup("/tmp/vcl.XXXXXXXX");
......@@ -201,6 +202,17 @@ mgt_CallCc(const char *source, struct vsb *sb)
of = NULL;
}
/* Next, try to load the object into the management process */
p = dlopen(of, RTLD_NOW | RTLD_LOCAL);
if (p == NULL) {
vsb_printf(sb, "Problem loading compiled VCL program:\n\t%s\n",
dlerror());
unlink(of);
free(of);
of = NULL;
} else
AZ(dlclose(p));
/* clean up and return */
unlink(sf);
free(sf);
......
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