From e1b77b61f320077dd41d8ea2a7fd74561084d75f Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 17 Feb 2014 12:10:12 +0100 Subject: [PATCH] Sentinel: better specify startup errors due to config file. Now it logs the file name if it is not accessible. Also there is a different error for the missing config file case, and for the non writable file case. --- src/sentinel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index fb8b220a..c25e01b1 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -417,8 +417,13 @@ void initSentinel(void) { void sentinelIsRunning(void) { redisLog(REDIS_WARNING,"Sentinel runid is %s", server.runid); - if (server.configfile == NULL || access(server.configfile,W_OK) == -1) { - redisLog(REDIS_WARNING,"Sentinel started without a config file, or config file not writable. Exiting..."); + if (server.configfile == NULL) { + redisLog(REDIS_WARNING, + "Sentinel started without a config file. Exiting..."); + } else if (access(server.configfile,W_OK) == -1) { + redisLog(REDIS_WARNING, + "Sentinel config file %s is not writable: %s. Exiting...", + server.configfile,strerror(errno)); exit(1); } }