Commit d51da61b authored by Eric Wong's avatar Eric Wong Committed by Max Kellermann

command: fix return status

This got broken when listHandlerFunc was removed. Since we no longer need it and it's confusing, remove processCommandInternal and just use process_command.
parent 836dcc28
...@@ -1378,25 +1378,21 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *cli ...@@ -1378,25 +1378,21 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *cli
return cmd; return cmd;
} }
static int processCommandInternal(struct client *client, int processCommand(struct client *client, char *commandString)
char *commandString, struct strnode *cmdnode)
{ {
int argc; int argc;
char *argv[COMMAND_ARGV_MAX] = { NULL }; char *argv[COMMAND_ARGV_MAX] = { NULL };
CommandEntry *cmd; CommandEntry *cmd;
int ret = -1; int ret = -1;
argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX); if (!(argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX)))
if (argc == 0)
return 0; return 0;
if ((cmd = getCommandEntryAndCheckArgcAndPermission(client, cmd = getCommandEntryAndCheckArgcAndPermission(client,
client_get_permission(client), client_get_permission(client),
argc, argv))) { argc, argv);
if (!cmdnode) if (cmd)
ret = cmd->handler(client, argc, argv); ret = cmd->handler(client, argc, argv);
}
current_command = NULL; current_command = NULL;
...@@ -1414,7 +1410,7 @@ int processListOfCommands(struct client *client, ...@@ -1414,7 +1410,7 @@ int processListOfCommands(struct client *client,
while (cur) { while (cur) {
DEBUG("processListOfCommands: process command \"%s\"\n", DEBUG("processListOfCommands: process command \"%s\"\n",
cur->data); cur->data);
ret = processCommandInternal(client, cur->data, cur); ret = processCommand(client, cur->data);
DEBUG("processListOfCommands: command returned %i\n", ret); DEBUG("processListOfCommands: command returned %i\n", ret);
if (ret != 0 || client_is_expired(client)) if (ret != 0 || client_is_expired(client))
goto out; goto out;
...@@ -1427,8 +1423,3 @@ out: ...@@ -1427,8 +1423,3 @@ out:
command_listNum = 0; command_listNum = 0;
return ret; return ret;
} }
int processCommand(struct client *client, char *commandString)
{
return processCommandInternal(client, commandString, NULL);
}
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