summaryrefslogtreecommitdiff
path: root/src/cluster.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-04-24 16:23:03 +0200
committerantirez <antirez@gmail.com>2014-04-24 16:23:03 +0200
commite3cf812c9e7db2bedd1063421d4b3bb1d46484be (patch)
tree46497060fd1e79b2a2bce51dee4759aa43bbf532 /src/cluster.c
parentdb06108bc17205f29e363b5ba1664e1b9dbd9afc (diff)
downloadredis-e3cf812c9e7db2bedd1063421d4b3bb1d46484be.tar.gz
clusterLoadConfig() REDIS_ERR retval semantics refined.
We should return REDIS_ERR to signal we can't read the configuration because there is no config file only after checking errno, othewise we risk to rewrite an existing file that was not accessible for some other reason.
Diffstat (limited to 'src/cluster.c')
-rw-r--r--src/cluster.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cluster.c b/src/cluster.c
index ecbcc0a92..be0522ca5 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -103,7 +103,16 @@ int clusterLoadConfig(char *filename) {
char *line;
int maxline, j;
- if (fp == NULL) return REDIS_ERR;
+ if (fp == NULL) {
+ if (errno == ENOENT) {
+ return REDIS_ERR;
+ } else {
+ redisLog(REDIS_WARNING,
+ "Loading the cluster node config from %s: %s",
+ filename, strerror(errno));
+ exit(1);
+ }
+ }
/* Check if the file is zero-length: if so return REDIS_ERR to signal
* we have to write the config. */