diff options
author | Max Kellermann <max@duempel.org> | 2014-02-09 08:05:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-09 08:07:48 +0100 |
commit | 570b12ec1392dc6561b21c7bb8b653eb7a922a01 (patch) | |
tree | 670fa261da1ee278273b095d29feb36688ada785 /src/command | |
parent | ac286ef734cb3d8cc59acb71096da29c6d83d690 (diff) | |
download | mpd-570b12ec1392dc6561b21c7bb8b653eb7a922a01.tar.gz mpd-570b12ec1392dc6561b21c7bb8b653eb7a922a01.tar.xz mpd-570b12ec1392dc6561b21c7bb8b653eb7a922a01.zip |
Idle: error out when unrecognized idle event was specified
Implements the error checks missing in commit 0bad8406
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/OtherCommands.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx index 3c0b6963a..b3564040c 100644 --- a/src/command/OtherCommands.cxx +++ b/src/command/OtherCommands.cxx @@ -33,7 +33,6 @@ #include "protocol/Result.hxx" #include "ls.hxx" #include "mixer/Volume.hxx" -#include "util/ASCII.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" #include "fs/AllocatedPath.hxx" @@ -363,17 +362,19 @@ CommandResult handle_idle(Client &client, gcc_unused int argc, gcc_unused char *argv[]) { - unsigned flags = 0, j; + unsigned flags = 0; int i; - const char *const* idle_names; - idle_names = idle_get_names(); for (i = 1; i < argc; ++i) { - for (j = 0; idle_names[j]; ++j) { - if (StringEqualsCaseASCII(argv[i], idle_names[j])) { - flags |= (1 << j); - } + unsigned event = idle_parse_name(argv[i]); + if (event == 0) { + command_error(client, ACK_ERROR_ARG, + "Unrecognized idle event: %s", + argv[i]); + return CommandResult::ERROR; } + + flags |= event; } /* No argument means that the client wants to receive everything */ |