summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2012-06-13 00:55:32 +0200
committerBertrik Sikken <bertrik@sikken.nl>2012-06-18 00:45:50 +0200
commitbeb61a93c58a2f97bc3f297ffdf3026b846fccca (patch)
treec952b8e34752eebe603d0f0c8687181214fed915 /apps/playlist.c
parent7292254053623f01405c8bf4522547fe639b080c (diff)
downloadrockbox-beb61a93c58a2f97bc3f297ffdf3026b846fccca.tar.gz
rockbox-beb61a93c58a2f97bc3f297ffdf3026b846fccca.tar.bz2
rockbox-beb61a93c58a2f97bc3f297ffdf3026b846fccca.zip
Not quite a fix for FS#12693 yet, but at least invalidate the playlist file descriptors after closing and removing
Change-Id: Ia43eb517d154d24a6bd581fa3aa69c99a28228ae
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 5b5f489cde..42f0b30139 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2049,6 +2049,7 @@ void playlist_shutdown(void)
flush_cached_control(playlist);
close(playlist->control_fd);
+ playlist->control_fd = -1;
mutex_unlock(playlist->control_mutex);
}
@@ -2838,8 +2839,11 @@ int playlist_set_current(struct playlist_info* playlist)
current_playlist.fd = playlist->fd;
close(playlist->control_fd);
+ playlist->control_fd = -1;
close(current_playlist.control_fd);
+ current_playlist.control_fd = -1;
remove(current_playlist.control_filename);
+ current_playlist.control_created = false;
if (rename(playlist->control_filename,
current_playlist.control_filename) < 0)
return -1;
@@ -2888,14 +2892,20 @@ void playlist_close(struct playlist_info* playlist)
if (!playlist)
return;
- if (playlist->fd >= 0)
+ if (playlist->fd >= 0) {
close(playlist->fd);
+ playlist->fd = -1;
+ }
- if (playlist->control_fd >= 0)
+ if (playlist->control_fd >= 0) {
close(playlist->control_fd);
+ playlist->control_fd = -1;
+ }
- if (playlist->control_created)
+ if (playlist->control_created) {
remove(playlist->control_filename);
+ playlist->control_created = false;
+ }
}
void playlist_sync(struct playlist_info* playlist)
@@ -3552,6 +3562,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
/* Replace the current playlist with the new one and update indices */
close(playlist->fd);
+ playlist->fd = -1;
if (remove(playlist->filename) >= 0)
{
if (rename(path, playlist->filename) >= 0)