diff options
author | Max Kellermann <max@duempel.org> | 2009-11-06 00:11:36 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-06 00:11:36 +0100 |
commit | a4970c66ef836badd95141bd3f9d3424a1dacdf2 (patch) | |
tree | 681a46f7969dae62c2f9e109bea8eed9944e3f13 | |
parent | 945287358b6e935d994a3411da097aba107e592d (diff) | |
download | mpd-a4970c66ef836badd95141bd3f9d3424a1dacdf2.tar.gz mpd-a4970c66ef836badd95141bd3f9d3424a1dacdf2.tar.xz mpd-a4970c66ef836badd95141bd3f9d3424a1dacdf2.zip |
playlist_list: rewind the stream before opening the playlist
If one plugin has failed to open the playlist, it may have consumed a
part of the stream already. This may lead to a failure in all
following plugins. Fix: rewind the stream before each open() call.
Diffstat (limited to '')
-rw-r--r-- | src/playlist_list.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/playlist_list.c b/src/playlist_list.c index f8d2839d6..c5c436f04 100644 --- a/src/playlist_list.c +++ b/src/playlist_list.c @@ -34,6 +34,7 @@ #include <assert.h> #include <string.h> +#include <stdio.h> static const struct playlist_plugin *const playlist_plugins[] = { &m3u_playlist_plugin, @@ -141,6 +142,10 @@ playlist_list_open_stream_mime(struct input_stream *is) if (playlist_plugins_enabled[i] && stringFoundInStringArray(plugin->mime_types, is->mime)) { + /* rewind the stream, so each plugin gets a + fresh start */ + input_stream_seek(is, 0, SEEK_SET); + playlist = playlist_plugin_open_stream(plugin, is); if (playlist != NULL) return playlist; @@ -163,6 +168,10 @@ playlist_list_open_stream_suffix(struct input_stream *is, const char *suffix) if (playlist_plugins_enabled[i] && stringFoundInStringArray(plugin->suffixes, suffix)) { + /* rewind the stream, so each plugin gets a + fresh start */ + input_stream_seek(is, 0, SEEK_SET); + playlist = playlist_plugin_open_stream(plugin, is); if (playlist != NULL) return playlist; |