summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-18 12:09:31 +0100
committerantirez <antirez@gmail.com>2015-03-18 12:09:39 +0100
commitd8236ea262f947ac27f5e2e324511796609a1752 (patch)
treede023ea125a314a79c36bd22b136633c4248082a
parent6adf3ca798d7d9511405c5aea7c800e7d42e2248 (diff)
downloadredis-d8236ea262f947ac27f5e2e324511796609a1752.tar.gz
Cluster: more robust slave check in CLUSTER REPLICATE.
There are rare conditions where node->slaveof may be NULL even if the node is a slave. To check by flag is much more robust.
-rw-r--r--src/cluster.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 74371f3ee..80cd77018 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -4058,7 +4058,7 @@ void clusterCommand(redisClient *c) {
}
/* Can't replicate a slave. */
- if (n->slaveof != NULL) {
+ if (nodeIsSlave(n)) {
addReplyError(c,"I can only replicate a master, not a slave.");
return;
}