summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--snac.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/snac.c b/snac.c
index 3cf146a..3fa4b94 100644
--- a/snac.c
+++ b/snac.c
@@ -30,6 +30,18 @@ int srv_running = 0;
30int dbglevel = 0; 30int dbglevel = 0;
31 31
32 32
33int mkdirx(const char *pathname)
34/* creates a directory with special permissions */
35{
36 int ret;
37
38 if ((ret = mkdir(pathname, DIR_PERM)) != -1)
39 ret = chmod(pathname, DIR_PERM);
40
41 return ret;
42}
43
44
33int valid_status(int status) 45int valid_status(int status)
34/* is this HTTP status valid? */ 46/* is this HTTP status valid? */
35{ 47{
@@ -149,7 +161,7 @@ void srv_archive(const char *direction, xs_dict *req,
149 xs *dir = xs_fmt("%s/archive/%s_%s", srv_basedir, date, direction); 161 xs *dir = xs_fmt("%s/archive/%s_%s", srv_basedir, date, direction);
150 FILE *f; 162 FILE *f;
151 163
152 if (mkdir(dir, DIR_PERM) != -1) { 164 if (mkdirx(dir) != -1) {
153 xs *meta_fn = xs_fmt("%s/_META", dir); 165 xs *meta_fn = xs_fmt("%s/_META", dir);
154 166
155 if ((f = fopen(meta_fn, "w")) != NULL) { 167 if ((f = fopen(meta_fn, "w")) != NULL) {