diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-08-29 17:46:14 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-08-29 21:53:35 +0200 |
commit | f005928d63165d28b32851f04f29055a4d0cdad5 (patch) | |
tree | 5386f28a558046dbe6e93b439f5e026441224c56 /main.c | |
parent | 4be89075c5bb5793f8c79da8f8df1accc1f0168f (diff) |
get data dir from env variable
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)); |