aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:50:16 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:50:16 +0200
commitf7e414d9347aaf2397f883181c8bdb6959380143 (patch)
tree0a8f8553b0cd744a678fecd76e302fb7e63c0ce7 /src/command.c
parent8e3c40f032d1c760b9dc11df654c577baaf5f76a (diff)
downloadmpd-f7e414d9347aaf2397f883181c8bdb6959380143.tar.gz
mpd-f7e414d9347aaf2397f883181c8bdb6959380143.tar.xz
mpd-f7e414d9347aaf2397f883181c8bdb6959380143.zip
volume: don't pass "fd" to changeVolumeLevel()
The "volume" library shouldn't talk to the client. Move error handling to command.c.
Diffstat (limited to '')
-rw-r--r--src/command.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c
index f197db393..c1422d2c0 100644
--- a/src/command.c
+++ b/src/command.c
@@ -911,21 +911,33 @@ static int handleListAll(int fd, mpd_unused int *permission,
static int handleVolume(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- int change;
+ int change, ret;
if (check_int(fd, &change, argv[1], need_integer) < 0)
return -1;
- return changeVolumeLevel(fd, change, 1);
+
+ ret = changeVolumeLevel(change, 1);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_SYSTEM,
+ "problems setting volume");
+
+ return ret;
}
static int handleSetVol(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- int level;
+ int level, ret;
if (check_int(fd, &level, argv[1], need_integer) < 0)
return -1;
- return changeVolumeLevel(fd, level, 0);
+
+ ret = changeVolumeLevel(level, 0);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_SYSTEM,
+ "problems setting volume");
+
+ return ret;
}
static int handleRepeat(int fd, mpd_unused int *permission,