From 438a1a84e8aa37a19a744c38488b261dd62c145c Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Wed, 18 Mar 2015 12:09:31 +0100
Subject: [PATCH] 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.
---
 src/cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cluster.c b/src/cluster.c
index d4c6300d..e24b15d2 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -4071,7 +4071,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;
         }