From d0232a23150975f8f92645b23d1afe7d31fbe5fd Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 31 Oct 2015 09:54:46 +0100 Subject: [PATCH] [mpd] Return playlists if lsinfo is called with an empty path (same handling as if the path is the root directory "/") --- src/mpd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mpd.c b/src/mpd.c index 4336595f..cc52921e 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -2675,17 +2675,6 @@ mpd_command_lsinfo(struct evbuffer *evbuf, int argc, char **argv, char **errmsg) int print_playlists; int ret; - print_playlists = 0; - if (argc > 1 && strncmp(argv[1], "/", 1) == 0 && strlen(argv[1]) == 1) - { - /* - * Special handling necessary if the root directory '/' is given. - * In this case additional to the directory contents the stored playlists will be returned. - * This behavior is deprecated in the mpd protocol but clients like ncmpccp or ympd uses it. - */ - print_playlists = 1; - } - if (argc < 2 || strlen(argv[1]) == 0 || (strncmp(argv[1], "/", 1) == 0 && strlen(argv[1]) == 1)) { @@ -2706,6 +2695,17 @@ mpd_command_lsinfo(struct evbuffer *evbuf, int argc, char **argv, char **errmsg) return -1; } + print_playlists = 0; + if (argc > 1 && (strncmp(parent, "/", 1) == 0 && strlen(parent) == 1)) + { + /* + * Special handling necessary if the root directory '/' is given. + * In this case additional to the directory contents the stored playlists will be returned. + * This behavior is deprecated in the mpd protocol but clients like ncmpccp or ympd uses it. + */ + print_playlists = 1; + } + fi = (struct filelist_info*)malloc(sizeof(struct filelist_info)); if (!fi) {