summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-07 09:25:01 +0100
committerdefault <nobody@localhost>2023-02-07 09:25:01 +0100
commit67f2d4318d76b305ab98a48ff48b47e2e87126c2 (patch)
treee8c72fcf2aaf9ff0f8ec59dd07894736d0ab01ac /snac.c
parent392c5147a396ab166dc04494e59f3f096e25e251 (diff)
New utility function mkdirx().
Diffstat (limited to 'snac.c')
-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;
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) {