aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-23 09:54:42 +0200
committerMax Kellermann <max@duempel.org>2008-10-23 09:54:42 +0200
commit4f807b3aaa9617dfc35fb73ec898c8c9a22fded4 (patch)
tree57bbfaf7d9f25bc6b24bddae2bf1e794e1d4e02d /src
parentfdc9a4cc5a464c0ede0c3de7978b9662f5d9136a (diff)
downloadmpd-4f807b3aaa9617dfc35fb73ec898c8c9a22fded4.tar.gz
mpd-4f807b3aaa9617dfc35fb73ec898c8c9a22fded4.tar.xz
mpd-4f807b3aaa9617dfc35fb73ec898c8c9a22fded4.zip
stored_playlist: don't map files outside the database
Don't attempt to map paths which are already absolute with map_song_fs(): check with song_in_database() instead of song_is_file().
Diffstat (limited to '')
-rw-r--r--src/playlist_save.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/playlist_save.c b/src/playlist_save.c
index c89afe684..9c72e0aef 100644
--- a/src/playlist_save.c
+++ b/src/playlist_save.c
@@ -29,7 +29,7 @@ playlist_print_song(FILE *file, const struct song *song)
{
char tmp1[MPD_PATH_MAX], tmp2[MPD_PATH_MAX];
- if (playlist_saveAbsolutePaths && song_is_file(song)) {
+ if (playlist_saveAbsolutePaths && song_in_database(song)) {
const char *path = map_song_fs(song, tmp1);
if (path != NULL)
fprintf(file, "%s\n", path);
@@ -46,7 +46,8 @@ playlist_print_uri(FILE *file, const char *uri)
char tmp[MPD_PATH_MAX];
const char *s;
- if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(uri))
+ if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(uri) &&
+ uri[0] != '/')
s = map_directory_child_fs(db_get_root(), uri, tmp);
else
s = utf8_to_fs_charset(tmp, uri);