diff options
author | Max Kellermann <max@duempel.org> | 2008-09-07 13:50:16 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-09 01:12:25 -0700 |
commit | 288c051c55e741bbf9387579ea7f066ab6f754f0 (patch) | |
tree | 2ef315138272fe1245325fe151ecaa72c6464b75 /src/command.c | |
parent | 2210ddee97bd16424e218a3894fcaca52a4ee080 (diff) | |
download | mpd-288c051c55e741bbf9387579ea7f066ab6f754f0.tar.gz mpd-288c051c55e741bbf9387579ea7f066ab6f754f0.tar.xz mpd-288c051c55e741bbf9387579ea7f066ab6f754f0.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.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c index e24c93d59..dc62481ff 100644 --- a/src/command.c +++ b/src/command.c @@ -871,21 +871,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, |