Commit a2f4f871 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

build command outside while loop

parent 37dc9e5a
......@@ -252,7 +252,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
return 1;
}
while(repeat--) {
/* Build the command to send */
cmd = sdscatprintf(sdsempty(),"*%d\r\n",argc);
for (j = 0; j < argc; j++) {
......@@ -261,9 +260,9 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
cmd = sdscatlen(cmd,argv[j],sdslen(argv[j]));
cmd = sdscatlen(cmd,"\r\n",2);
}
anetWrite(fd,cmd,sdslen(cmd));
sdsfree(cmd);
while(repeat--) {
anetWrite(fd,cmd,sdslen(cmd));
while (config.monitor_mode) {
cliReadSingleLineReply(fd,0);
}
......@@ -277,7 +276,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
}
retval = cliReadReply(fd);
if (retval) {
return retval;
}
......
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