Commit 2ff21d5e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Clone the stevedore before calling its init function and be more precise

about any optional arguments.


git-svn-id: http://www.varnish-cache.org/svn/trunk@174 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ab99297e
......@@ -309,22 +309,27 @@ cmp_storage(struct stevedore *s, const char *p, const char *q)
static void
setup_storage(const char *sflag)
{
const char *p;
const char *p, *q;
struct stevedore *stp;
p = strchr(sflag, ',');
q = p = strchr(sflag, ',');
if (p == NULL)
p = strchr(sflag, '\0');
q = p = strchr(sflag, '\0');
else
q++;
if (!cmp_storage(&sma_stevedore, sflag, p)) {
heritage.stevedore = &sma_stevedore;
stp = &sma_stevedore;
} else if (!cmp_storage(&smf_stevedore, sflag, p)) {
heritage.stevedore = &smf_stevedore;
stp = &smf_stevedore;
} else {
fprintf(stderr, "Unknown storage method \"%*.*s\"\n",
p - sflag, p - sflag, sflag);
exit (2);
}
if (heritage.stevedore->init != NULL)
heritage.stevedore->init(heritage.stevedore, p);
heritage.stevedore = malloc(sizeof *heritage.stevedore);
*heritage.stevedore = *stp;
if (stp->init != NULL)
stp->init(heritage.stevedore, q);
}
/*--------------------------------------------------------------------*/
......
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