diff --git a/src/config.c b/src/config.c index 954a96e75..a83f5adc0 100644 --- a/src/config.c +++ b/src/config.c @@ -1045,13 +1045,10 @@ void configGetCommand(client *c) { addReplyBulkCString(c,buf); matches++; } - if (stringmatch(pattern,"slaveof",1) || - stringmatch(pattern,"replicaof",1)) - { - char *optname = stringmatch(pattern,"slaveof",1) ? - "slaveof" : "replicaof"; + for (int i = 0; i < 2; i++) { + char *optname = i == 0 ? "replicaof" : "slaveof"; + if (!stringmatch(pattern, optname, 1)) continue; char buf[256]; - addReplyBulkCString(c,optname); if (server.masterhost) snprintf(buf,sizeof(buf),"%s %d", diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index 199a8cc30..ce3f54556 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -149,6 +149,7 @@ start_server {tags {"introspection"}} { io-threads logfile unixsocketperm + replicaof slaveof requirepass server_cpulist