commit - ef5057cdec1086930831b44ffdd9cac4606f953d
commit + e371817b3437abf8e34475ff2544cb666769ccae
blob - cb95ad843ee75ad6d7c1fa6dd30ae2d707f7731d
blob + d424969505e4162ff71693a37d30ee305cce2210
--- gmid.c
+++ gmid.c
strlcpy(conf->chroot, chroot, sizeof(conf->chroot));
}
- if (conftest) {
- if (config_test(conf) == -1)
- fatalx("failed to load the configuration");
- fprintf(stderr, "config OK\n");
- if (conftest > 1)
- main_print_conf(conf);
- return 0;
- }
-
if ((ps = calloc(1, sizeof(*ps))) == NULL)
fatal("calloc");
ps->ps_env = conf;
sizeof(conf->chroot));
}
+ if (conftest) {
+ conf->conftest = 1;
+ if (config_test(conf) == -1)
+ fatalx("failed to load the configuration");
+ fprintf(stderr, "config OK\n");
+ if (conftest > 1)
+ main_print_conf(conf);
+ return 0;
+ }
+
ps->ps_instances[PROC_SERVER] = conf->prefork;
ps->ps_instance = proc_instance;
if (title != NULL)
blob - 84b57150a51662263e577c24bda1f7ee05bc017c
blob + 9b4ee4af718198719b0833ddb76610cc946584d7
--- gmid.h
+++ gmid.h
char *log_access;
enum log_format log_format;
int use_privsep_crypto;
+ int conftest;
struct fcgihead fcgi;
struct vhosthead hosts;
blob - 9aee9da940260fceccce8492865c8e46e304b071
blob + b6b1cfb8be3c8fc37b82be69b1b993ee37c5cdae
--- server.c
+++ server.c
{
struct vhost *h;
struct location *l;
+ char path[PATH_MAX], *p;
+ int r;
TAILQ_FOREACH(h, &conf->hosts, vhosts) {
TAILQ_FOREACH(l, &h->locations, locations) {
if (*l->dir == '\0')
continue;
- l->dirfd = open(l->dir, O_RDONLY | O_DIRECTORY);
+
+ p = l->dir;
+
+ if (conf->conftest && *conf->chroot != '\0') {
+ r = snprintf(path, sizeof(path), "%s/%s",
+ conf->chroot, l->dir);
+ if (r < 0 || (size_t)r >= sizeof(path))
+ fatalx("path too long: %s", l->dir);
+ p = path;
+ }
+
+ l->dirfd = open(p, O_RDONLY | O_DIRECTORY);
if (l->dirfd == -1)
fatal("open %s for domain %s", l->dir,
h->domain);