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

(cherry picked from commit af035c1e1d3bcaf662051cff4dc49f6051321c9c)
This commit is contained in:
Istemi Ekin Akkus 2021-04-25 09:05:12 +02:00 committed by Oran Agra
parent 6384fe3414
commit 2ccb926314

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);