Commit 3983dac1 authored by John Sully's avatar John Sully Committed by antirez
Browse files

Replicas aren't allowed to run the replicaof command

parent befcbfbe
......@@ -1793,6 +1793,14 @@ void slaveofCommand(client *c) {
} else {
long port;
if (c->flags & CLIENT_SLAVE)
{
/* If a client is already a replica they cannot run this command,
* because it involves flushing all replicas (including this client) */
addReplyError(c, "Command is not valid when client is a replica.");
return;
}
if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment