aboutsummaryrefslogtreecommitdiffstats
path: root/src/storedPlaylist.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-09 09:59:34 +0200
committerMax Kellermann <max@duempel.org>2008-09-09 09:59:34 +0200
commit35494158c8608525a38457bbf3412d19ae18e845 (patch)
treef917e52e204f1c5b1db81e566ba35871067ee569 /src/storedPlaylist.c
parent5c81b716e21146a59d6636fcff3b0dc5687a5760 (diff)
downloadmpd-35494158c8608525a38457bbf3412d19ae18e845.tar.gz
mpd-35494158c8608525a38457bbf3412d19ae18e845.tar.xz
mpd-35494158c8608525a38457bbf3412d19ae18e845.zip
storedPlaylist: correctly expand path when writing
Otherwise we'd be writing to whatever directory that mpd is running in.
Diffstat (limited to '')
-rw-r--r--src/storedPlaylist.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c
index fef8a70f3..512a29b7c 100644
--- a/src/storedPlaylist.c
+++ b/src/storedPlaylist.c
@@ -59,22 +59,23 @@ static ListNode *nodeOfStoredPlaylist(List *list, int idx)
}
static enum playlist_result
-writeStoredPlaylistToPath(List *list, const char *fspath)
+writeStoredPlaylistToPath(List *list, const char *utf8path)
{
ListNode *node;
FILE *file;
char *s;
+ char path_max_tmp[MPD_PATH_MAX];
+
+ assert(utf8path != NULL);
- assert(fspath != NULL);
+ utf8_to_fs_playlist_path(path_max_tmp, utf8path);
- while (!(file = fopen(fspath, "w")) && errno == EINTR);
+ while (!(file = fopen(path_max_tmp, "w")) && errno == EINTR);
if (file == NULL)
return PLAYLIST_RESULT_ERRNO;
node = list->firstNode;
while (node != NULL) {
- char path_max_tmp[MPD_PATH_MAX];
-
s = utf8_to_fs_charset(path_max_tmp, (char *)node->data);
if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(s))
s = rmp2amp_r(path_max_tmp, s);