diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -53,6 +53,7 @@ static const char *const pages[PAGE__MAX] = { int main(void) { + char *data_dir; enum kcgi_err parse_err; struct kreq r; struct http_ret ret; @@ -65,8 +66,12 @@ main(void) http_exit(NULL, KHTTP_500, "Unable to parse request: %s", kcgi_strerror(parse_err)); + data_dir = config_data_dir(); + if (data_dir == NULL) + http_exit(NULL, KHTTP_500, "Data dir not configured"); + /* A bit of security cannot hurt */ - if (-1 == unveil(DATA_DIR, "r") + if (-1 == unveil(data_dir, "r") || -1 == unveil(TEMPLATE_DIR, "r") || -1 == unveil(NULL, NULL)) http_exit(&r, KHTTP_500, "Unveil failed: %s", strerror(errno)); |