diff options
author | default <nobody@localhost> | 2023-02-07 09:25:01 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-02-07 09:25:01 +0100 |
commit | 67f2d4318d76b305ab98a48ff48b47e2e87126c2 (patch) | |
tree | e8c72fcf2aaf9ff0f8ec59dd07894736d0ab01ac /snac.c | |
parent | 392c5147a396ab166dc04494e59f3f096e25e251 (diff) |
New utility function mkdirx().
Diffstat (limited to 'snac.c')
-rw-r--r-- | snac.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -30,6 +30,18 @@ int srv_running = 0; int dbglevel = 0; +int mkdirx(const char *pathname) +/* creates a directory with special permissions */ +{ + int ret; + + if ((ret = mkdir(pathname, DIR_PERM)) != -1) + ret = chmod(pathname, DIR_PERM); + + return ret; +} + + int valid_status(int status) /* is this HTTP status valid? */ { @@ -149,7 +161,7 @@ void srv_archive(const char *direction, xs_dict *req, xs *dir = xs_fmt("%s/archive/%s_%s", srv_basedir, date, direction); FILE *f; - if (mkdir(dir, DIR_PERM) != -1) { + if (mkdirx(dir) != -1) { xs *meta_fn = xs_fmt("%s/_META", dir); if ((f = fopen(meta_fn, "w")) != NULL) { |