From 55f1be5a582dee523e06d8ca081dcee70bc36ea0 Mon Sep 17 00:00:00 2001
From: Daniel Salzman <daniel.salzman@nic.cz>
Date: Wed, 19 Aug 2015 13:32:58 +0200
Subject: [PATCH] process: remove storage writability check

---
 src/knot/ctl/process.c | 37 -------------------------------------
 1 file changed, 37 deletions(-)

diff --git a/src/knot/ctl/process.c b/src/knot/ctl/process.c
index 4188eff46e..02ac88cd88 100644
--- a/src/knot/ctl/process.c
+++ b/src/knot/ctl/process.c
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <signal.h>
 #include <grp.h>
-#include <assert.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -32,12 +31,8 @@
 #include "knot/ctl/process.h"
 #include "knot/conf/conf.h"
 #include "knot/common/log.h"
-#include "libknot/errcode.h"
-#include "libknot/internal/mem.h"
 #include "libknot/libknot.h"
 
-#define LOCK_FILE	"knot.lock"
-
 char* pid_filename()
 {
 	rcu_read_lock();
@@ -169,38 +164,6 @@ int proc_update_privileges(int uid, int gid)
 		}
 	}
 
-	/* Check storage writability. */
-	conf_iter_t iter = conf_iter(conf(), C_ZONE);
-	while (iter.code == KNOT_EOK) {
-		conf_val_t id = conf_iter_id(conf(), &iter);
-		conf_val_t val = conf_zone_get(conf(), C_STORAGE, conf_dname(&id));
-		char *storage = conf_abs_path(&val, NULL);
-		if (storage == NULL) {
-			conf_iter_finish(conf(), &iter);
-			return KNOT_ENOMEM;
-		}
-
-		char *lfile = sprintf_alloc("%s/%s", storage, LOCK_FILE);
-		assert(lfile != NULL);
-		FILE *fp = fopen(lfile, "w");
-		if (fp == NULL) {
-			log_error("storage directory '%s' is not writable",
-			          storage);
-			free(lfile);
-			free(storage);
-			conf_iter_finish(conf(), &iter);
-			return KNOT_EACCES;
-		} else {
-			fclose(fp);
-			unlink(lfile);
-		}
-		free(lfile);
-		free(storage);
-
-		conf_iter_next(conf(), &iter);
-	}
-	conf_iter_finish(conf(), &iter);
-
 	return KNOT_EOK;
 }
 
-- 
GitLab