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.
This commit is contained in:
antirez 2014-02-17 12:10:12 +01:00
parent 51bd9da1fd
commit e1b77b61f3

View File

@ -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);
}
}