Modules: Fix RM_GetClusterNodeInfo() to correctly populate the master_id (#8846)

This commit is contained in:
Istemi Ekin Akkus 2021-04-25 09:05:12 +02:00 committed by GitHub
parent e43dbd03f3
commit af035c1e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6168,7 +6168,7 @@ int RM_GetClusterNodeInfo(RedisModuleCtx *ctx, const char *id, char *ip, char *m
/* If the information is not available, the function will set the
* field to zero bytes, so that when the field can't be populated the
* function kinda remains predictable. */
if (node->flags & CLUSTER_NODE_MASTER && node->slaveof)
if (node->flags & CLUSTER_NODE_SLAVE && node->slaveof)
memcpy(master_id,node->slaveof->name,REDISMODULE_NODE_ID_LEN);
else
memset(master_id,0,REDISMODULE_NODE_ID_LEN);