Skip to content
Snippets Groups Projects
Commit 2ecb72b1 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

check writeability of storage directory for each zone

parent 099d6c65
No related branches found
No related tags found
No related merge requests found
......@@ -179,19 +179,25 @@ int proc_update_privileges(int uid, int gid)
/* Check storage writeability. */
int ret = KNOT_EOK;
char *lfile = strcdup(conf()->storage, "/knot.lock");
assert(lfile != NULL);
FILE* fp = fopen(lfile, "w");
if (fp == NULL) {
log_server_warning("Storage directory '%s' is not writeable.\n",
conf()->storage);
ret = KNOT_EACCES;
} else {
fclose(fp);
unlink(lfile);
}
conf_zone_t *zone;
WALK_LIST(zone, conf()->zones) {
char *lfile = strcdup(zone->storage, "/knot.lock");
assert(lfile != NULL);
FILE* fp = fopen(lfile, "w");
if (fp == NULL) {
log_server_warning("Storage directory '%s' is not "
"writeable.\n", zone->storage);
ret = KNOT_EACCES;
} else {
fclose(fp);
unlink(lfile);
}
free(lfile);
free(lfile);
if (ret != KNOT_EOK) {
break;
}
}
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment