aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-13 16:30:44 +0200
committerMax Kellermann <max@duempel.org>2008-10-13 16:30:44 +0200
commitbc85e92a722d945d193c9f3881e4ee9f96c8f2b6 (patch)
treea09dabcccbd447ea1bb162047ae8090a24376a7a /src/playlist.c
parent07c9b62764c2704380338dd26db7dc4d9b67dc2e (diff)
downloadmpd-bc85e92a722d945d193c9f3881e4ee9f96c8f2b6.tar.gz
mpd-bc85e92a722d945d193c9f3881e4ee9f96c8f2b6.tar.xz
mpd-bc85e92a722d945d193c9f3881e4ee9f96c8f2b6.zip
playlist: don't use isPlaylist() in deletePlaylist()
The only caller of deletePlaylist() appends PLAYLIST_FILE_SUFFIX, so we can be sure it's already there. We don't need to stat the file, since unlink() does all the checking.
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 840c9c6b5..34a2311aa 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1185,11 +1185,10 @@ enum playlist_result deletePlaylist(const char *utf8file)
utf8_to_fs_playlist_path(path_max_tmp, utf8file);
- if (!isPlaylist(path_max_tmp))
- return PLAYLIST_RESULT_NO_SUCH_LIST;
-
if (unlink(path_max_tmp) < 0)
- return PLAYLIST_RESULT_ERRNO;
+ return errno == ENOENT
+ ? PLAYLIST_RESULT_NO_SUCH_LIST
+ : PLAYLIST_RESULT_ERRNO;
return PLAYLIST_RESULT_SUCCESS;
}