aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:51:50 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-09 01:12:38 -0700
commit2a6a8a35c6b31e3c83891076dab86dc2da2d82ae (patch)
tree27ca71bfba317352b13c25850effc3497600be9d /src/command.c
parent288c051c55e741bbf9387579ea7f066ab6f754f0 (diff)
downloadmpd-2a6a8a35c6b31e3c83891076dab86dc2da2d82ae.tar.gz
mpd-2a6a8a35c6b31e3c83891076dab86dc2da2d82ae.tar.xz
mpd-2a6a8a35c6b31e3c83891076dab86dc2da2d82ae.zip
audio: don't pass "fd" to {en,dis}ableAudioDevice()
No protocol code in the audio output library.
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c
index dc62481ff..b67a57522 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1137,21 +1137,31 @@ static int handleCrossfade(int fd, mpd_unused int *permission,
static int handleEnableDevice(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- int device;
+ int device, ret;
if (check_int(fd, &device, argv[1], check_non_negative, argv[1]) < 0)
return -1;
- return enableAudioDevice(fd, device);
+
+ ret = enableAudioDevice(device);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST, "No such audio output");
+
+ return ret;
}
static int handleDisableDevice(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- int device;
+ int device, ret;
if (check_int(fd, &device, argv[1], check_non_negative, argv[1]) < 0)
return -1;
- return disableAudioDevice(fd, device);
+
+ ret = disableAudioDevice(device);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST, "No such audio output");
+
+ return ret;
}
static int handleDevices(int fd, mpd_unused int *permission,