aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:44:20 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-09 01:11:08 -0700
commit3884c89a2ec5378f54ebbaf4402d9d5438e80b92 (patch)
treedcab8933f9c548e810e650970095d108421f1bf1
parent38526852f3c40a6014f86b832b37d31507f6131b (diff)
downloadmpd-3884c89a2ec5378f54ebbaf4402d9d5438e80b92.tar.gz
mpd-3884c89a2ec5378f54ebbaf4402d9d5438e80b92.tar.xz
mpd-3884c89a2ec5378f54ebbaf4402d9d5438e80b92.zip
playlist: PlaylistInfo() does not call commandError()
Continuing the effort of removing protocol specific calls from the core libraries: let the command.c code call commandError() based on PlaylistInfo's return value.
-rw-r--r--src/command.c16
-rw-r--r--src/playlist.c5
2 files changed, 15 insertions, 6 deletions
diff --git a/src/command.c b/src/command.c
index 1634394d0..59a99141a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -538,13 +538,25 @@ static int handleLoad(int fd, mpd_unused int *permission,
static int handleListPlaylist(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- return PlaylistInfo(fd, argv[1], 0);
+ int ret;
+
+ ret = PlaylistInfo(fd, argv[1], 0);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST, "No such playlist");
+
+ return ret;
}
static int handleListPlaylistInfo(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- return PlaylistInfo(fd, argv[1], 1);
+ int ret;
+
+ ret = PlaylistInfo(fd, argv[1], 1);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST, "No such playlist");
+
+ return ret;
}
static int handleLsInfo(int fd, mpd_unused int *permission,
diff --git a/src/playlist.c b/src/playlist.c
index 562a4e7e7..ca79393b0 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1387,11 +1387,8 @@ int PlaylistInfo(int fd, const char *utf8file, int detail)
ListNode *node;
List *list;
- if (!(list = loadStoredPlaylist(utf8file))) {
- commandError(fd, ACK_ERROR_NO_EXIST, "could not open playlist "
- "\"%s\": %s", utf8file, strerror(errno));
+ if (!(list = loadStoredPlaylist(utf8file)))
return -1;
- }
node = list->firstNode;
while (node != NULL) {