From b1f4203afddca8c70557e3e71073f2c75f02fb6f Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 10 Dec 2018 12:31:10 +0100 Subject: RESP3: DEBUG PROTOCOL: fix strcasecmp() check. --- src/debug.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/debug.c b/src/debug.c index c9435e720..d43dcc97a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -533,26 +533,26 @@ NULL /* DEBUG PROTOCOL [string|integer|double|bignum|null|array|set|map| * attrib|push|verbatim|true|false|state|err|bloberr] */ char *name = c->argv[2]->ptr; - if (strcasecmp(name,"string")) { + if (!strcasecmp(name,"string")) { addReplyBulkCString(c,"Hello World"); - } else if (strcasecmp(name,"integer")) { + } else if (!strcasecmp(name,"integer")) { addReplyLongLong(c,12345); - } else if (strcasecmp(name,"double")) { + } else if (!strcasecmp(name,"double")) { addReplyDouble(c,3.14159265359); - } else if (strcasecmp(name,"bignum")) { + } else if (!strcasecmp(name,"bignum")) { addReplyString(c,"(1234567999999999999999999999999999999\r\n",40); - } else if (strcasecmp(name,"null")) { + } else if (!strcasecmp(name,"null")) { addReplyNull(c); - } else if (strcasecmp(name,"array")) { + } else if (!strcasecmp(name,"array")) { addReplyArrayLen(c,3); for (int j = 0; j < 3; j++) addReplyLongLong(c,j); - } else if (strcasecmp(name,"set")) { + } else if (!strcasecmp(name,"set")) { addReplySetLen(c,3); for (int j = 0; j < 3; j++) addReplyLongLong(c,j); - } else if (strcasecmp(name,"map")) { + } else if (!strcasecmp(name,"map")) { addReplyMapLen(c,3); for (int j = 0; j < 3; j++) addReplyLongLong(c,j); - } else if (strcasecmp(name,"attrib")) { + } else if (!strcasecmp(name,"attrib")) { addReplyAttributeLen(c,1); addReplyBulkCString(c,"key-popularity"); addReplyArrayLen(c,2); @@ -561,7 +561,7 @@ NULL /* Attributes are not real replies, so a well formed reply should * also have a normal reply type after the attribute. */ addReplyBulkCString(c,"Some real reply following the attribute"); - } else if (strcasecmp(name,"push")) { + } else if (!strcasecmp(name,"push")) { addReplyPushLen(c,2); addReplyBulkCString(c,"server-cpu-usage"); addReplyLongLong(c,42); -- cgit v1.2.1