summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--daemon.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/daemon.c b/daemon.c
index 88f59b2..efeaf22 100644
--- a/daemon.c
+++ b/daemon.c
@@ -216,6 +216,9 @@ int main(int argc, char *argv[]) {
 		}
 	}
 
+	error = access(configPath, R_OK);
+	if (error) err(EX_NOINPUT, "%s", configPath);
+
 	error = access(serviceDir, X_OK);
 	if (error) err(EX_NOINPUT, "%s", serviceDir);
 
@@ -269,9 +272,6 @@ int main(int argc, char *argv[]) {
 	int writer = open(fifoPath, O_WRONLY | O_NONBLOCK | O_CLOEXEC);
 	if (writer < 0) err(EX_CANTCREAT, "%s", fifoPath);
 
-	error = parseConfig(configPath);
-	if (error) return EX_DATAERR;
-
 	if (daemonize) {
 		error = daemon(0, 0);
 		if (error) {
@@ -306,6 +306,7 @@ int main(int argc, char *argv[]) {
 	signal(SIGCHLD, signalHandler);
 	signal(SIGINFO, signalHandler);
 
+	parseConfig(configPath);
 	for (size_t i = 0; i < services.len; ++i) {
 		serviceStart(&services.ptr[i]);
 	}