diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-10-05 00:47:35 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-10-05 00:48:42 -0700 |
commit | 4e11e2960ba4e10e3fba61abed2e97c745581245 (patch) | |
tree | 860981f278cf54f09f6cd91d04fbe3bbdba61a1d | |
parent | c4802008b899cc2d272d5e9b6c7000736ed3a6df (diff) | |
download | mpd-4e11e2960ba4e10e3fba61abed2e97c745581245.tar.gz mpd-4e11e2960ba4e10e3fba61abed2e97c745581245.tar.xz mpd-4e11e2960ba4e10e3fba61abed2e97c745581245.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/command.c b/src/command.c index cc5f615c7..6ce5cbed5 100644 --- a/src/command.c +++ b/src/command.c @@ -1357,24 +1357,19 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(int fd, return cmd; } -static int processCommandInternal(int fd, mpd_unused int *permission, - char *commandString, struct strnode *cmdnode) +int processCommand(int fd, int *perm, char *commandString) { int argc; char *argv[COMMAND_ARGV_MAX] = { NULL }; CommandEntry *cmd; int ret = -1; - argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX); - - if (argc == 0) + if (!(argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX))) return 0; - if ((cmd = getCommandEntryAndCheckArgcAndPermission(fd, permission, - argc, argv))) { - if (!cmdnode) - ret = cmd->handler(fd, permission, argc, argv); - } + cmd = getCommandEntryAndCheckArgcAndPermission(fd, perm, argc, argv); + if (cmd) + ret = cmd->handler(fd, perm, argc, argv); current_command = NULL; @@ -1392,7 +1387,7 @@ int processListOfCommands(int fd, int *permission, int *expired, while (cur) { DEBUG("processListOfCommands: process command \"%s\"\n", cur->data); - ret = processCommandInternal(fd, permission, cur->data, cur); + ret = processCommand(fd, permission, cur->data); DEBUG("processListOfCommands: command returned %i\n", ret); if (ret != 0 || (*expired) != 0) goto out; @@ -1406,11 +1401,6 @@ out: return ret; } -int processCommand(int fd, int *permission, char *commandString) -{ - return processCommandInternal(fd, permission, commandString, NULL); -} - mpd_fprintf_ void commandError(int fd, int error, const char *fmt, ...) { va_list args; |