From 49b08f0b497063598db7395e33d56cddc2b4ef89 Mon Sep 17 00:00:00 2001 From: Binbin Date: Sun, 9 Jul 2023 14:47:34 +0800 Subject: [PATCH] Fix SCRIPT EXISTS arity This is a minor fix, SCRIPT EXISTS requires at least three arguments. Before the change, we can do this: ``` 127.0.0.1:6666> script exists (empty array) ``` After: we will return wrong number of arguments error. It's just a tiny bug or cleanup. --- src/commands/cmd_script.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/cmd_script.cc b/src/commands/cmd_script.cc index 4dfbca2b506..a0e4dff5118 100644 --- a/src/commands/cmd_script.cc +++ b/src/commands/cmd_script.cc @@ -79,7 +79,7 @@ class CommandScript : public Commander { return s; } *output = redis::SimpleString("OK"); - } else if (args_.size() >= 2 && subcommand_ == "exists") { + } else if (args_.size() >= 3 && subcommand_ == "exists") { *output = redis::MultiLen(args_.size() - 2); for (size_t j = 2; j < args_.size(); j++) { if (svr->ScriptExists(args_[j]).IsOK()) {