mgt_CallCc(const char *source, struct vsb *sb)
{
FILE *fo, *fs;
- char *of, *sf, buf[BUFSIZ];
- int i, j, sfd;
+ char sf[] = "./vcl.XXXXXXXX";
+ char *of;
+ char buf[BUFSIZ];
+ int i, j, len, sfd;
void *p;
/* Create temporary C source file */
- asprintf(&sf, "/tmp/%s/vcl.XXXXXXXX", params->name);
- assert(sf != NULL);
sfd = mkstemp(sf);
if (sfd < 0) {
vsb_printf(sb,
return (NULL);
}
fs = fdopen(sfd, "r+");
- assert(fs != NULL);
+ AN(fs);
if (fputs(source, fs) < 0 || fflush(fs)) {
vsb_printf(sb,
rewind(fs);
/* Name the output shared library */
- asprintf(&of, "/tmp/%s/vcl.XXXXXXXX", params->name);
- assert(of != NULL);
- of = mktemp(of);
- assert(of != NULL);
+ of = strdup(sf);
+ AN(of);
+ memcpy(of, "./bin", 5);
/* Attempt to open a pipe to the system C-compiler */
- sprintf(buf,
- "ln -f %s /tmp/%s/_.c ;" /* XXX: for debugging */
+ len = snprintf(buf, sizeof buf,
+ "ln -f %s _.c ;" /* XXX: for debugging */
"exec cc -fpic -shared -Wl,-x -o %s -x c - < %s 2>&1",
- sf, params->name, of, sf);
+ sf, of, sf);
+ xxxassert(len < sizeof buf);
fo = popen(buf, "r");
if (fo == NULL) {
j++;
}
vsb_cat(sb, buf);
- }
+ }
i = pclose(fo);
if (j == 0 && i != 0)
/* clean up and return */
unlink(sf);
- free(sf);
fclose(fs);
return (of);
}
struct sess;
struct iovec;
-typedef void storage_init_f(struct stevedore *, const char *spec, const char *name);
+typedef void storage_init_f(struct stevedore *, const char *spec);
typedef void storage_open_f(struct stevedore *);
typedef struct storage *storage_alloc_f(struct stevedore *, size_t size);
typedef void storage_trim_f(struct storage *, size_t size);
}
static void
-smf_init(struct stevedore *parent, const char *spec, const char *varnish_name)
+smf_init(struct stevedore *parent, const char *spec)
{
char *size;
char *p, *q;
/* If no size specified, use 50% of filesystem free space */
if (spec == NULL || *spec == '\0')
- asprintf(&p, "/tmp/%s,50%%", varnish_name);
+ asprintf(&p, ".,50%%");
else if (strchr(spec, ',') == NULL)
asprintf(&p, "%s,", spec);
else
heritage.stevedore = malloc(sizeof *heritage.stevedore);
*heritage.stevedore = *stp;
if (stp->init != NULL)
- stp->init(heritage.stevedore, q, params->name);
+ stp->init(heritage.stevedore, q);
}
/*--------------------------------------------------------------------*/
char *p;
struct cli cli[1];
struct pidfh *pfh = NULL;
- char buf[BUFSIZ];
setbuf(stdout, NULL);
setbuf(stderr, NULL);
setup_storage(s_arg);
setup_hash(h_arg);
- sprintf(buf, "/tmp/%s/%s", params->name, SHMLOG_FILENAME);
- VSL_MgtInit(buf, 8*1024*1024);
+ VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024);
if (d_flag == 1)
DebugStunt();