aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c
index a11978a6c..238761f74 100644
--- a/src/command.c
+++ b/src/command.c
@@ -442,7 +442,13 @@ static int handleAdd(int fd, mpd_unused int *permission,
if (isRemoteUrl(path))
return addToPlaylist(path, NULL);
- result = addAllIn(fd, path);
+ result = addAllIn(path);
+ if (result == (enum playlist_result)-1) {
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
+ return -1;
+ }
+
return print_playlist_result(fd, result);
}
@@ -658,6 +664,9 @@ static int handleFind(int fd, mpd_unused int *permission,
}
ret = findSongsIn(fd, NULL, numItems, items);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
freeLocateTagItemArray(numItems, items);
@@ -680,6 +689,9 @@ static int handleSearch(int fd, mpd_unused int *permission,
}
ret = searchForSongsIn(fd, NULL, numItems, items);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
freeLocateTagItemArray(numItems, items);
@@ -702,6 +714,9 @@ static int handleCount(int fd, mpd_unused int *permission,
}
ret = searchStatsForSongsIn(fd, NULL, numItems, items);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
freeLocateTagItemArray(numItems, items);
@@ -840,10 +855,17 @@ static int handleListAll(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
char *directory = NULL;
+ int ret;
if (argc == 2)
directory = argv[1];
- return printAllIn(fd, directory);
+
+ ret = printAllIn(fd, directory);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
+
+ return ret;
}
static int handleVolume(int fd, mpd_unused int *permission,
@@ -962,6 +984,10 @@ static int handleList(int fd, mpd_unused int *permission,
if (conditionals)
freeLocateTagItemArray(numConditionals, conditionals);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
+
return ret;
}
@@ -1055,10 +1081,16 @@ static int handleListAllInfo(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
char *directory = NULL;
+ int ret;
if (argc == 2)
directory = argv[1];
- return printInfoForAllIn(fd, directory);
+ ret = printInfoForAllIn(fd, directory);
+ if (ret == -1)
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
+
+ return ret;
}
static int handlePing(mpd_unused int fd, mpd_unused int *permission,
@@ -1175,7 +1207,14 @@ static int handlePlaylistAdd(int fd, mpd_unused int *permission,
if (isRemoteUrl(path))
result = addToStoredPlaylist(path, playlist);
else
- result = addAllInToStoredPlaylist(fd, path, playlist);
+ result = addAllInToStoredPlaylist(path, playlist);
+
+ if (result == (enum playlist_result)-1) {
+ commandError(fd, ACK_ERROR_NO_EXIST,
+ "directory or file not found");
+ return -1;
+ }
+
return print_playlist_result(fd, result);
}