diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2012-06-13 00:55:32 +0200 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2012-06-18 00:45:50 +0200 |
commit | beb61a93c58a2f97bc3f297ffdf3026b846fccca (patch) | |
tree | c952b8e34752eebe603d0f0c8687181214fed915 /apps/playlist.c | |
parent | 7292254053623f01405c8bf4522547fe639b080c (diff) | |
download | rockbox-beb61a93c58a2f97bc3f297ffdf3026b846fccca.tar.gz 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.c | 17 |
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) | |||
2049 | flush_cached_control(playlist); | 2049 | flush_cached_control(playlist); |
2050 | 2050 | ||
2051 | close(playlist->control_fd); | 2051 | close(playlist->control_fd); |
2052 | playlist->control_fd = -1; | ||
2052 | 2053 | ||
2053 | mutex_unlock(playlist->control_mutex); | 2054 | mutex_unlock(playlist->control_mutex); |
2054 | } | 2055 | } |
@@ -2838,8 +2839,11 @@ int playlist_set_current(struct playlist_info* playlist) | |||
2838 | current_playlist.fd = playlist->fd; | 2839 | current_playlist.fd = playlist->fd; |
2839 | 2840 | ||
2840 | close(playlist->control_fd); | 2841 | close(playlist->control_fd); |
2842 | playlist->control_fd = -1; | ||
2841 | close(current_playlist.control_fd); | 2843 | close(current_playlist.control_fd); |
2844 | current_playlist.control_fd = -1; | ||
2842 | remove(current_playlist.control_filename); | 2845 | remove(current_playlist.control_filename); |
2846 | current_playlist.control_created = false; | ||
2843 | if (rename(playlist->control_filename, | 2847 | if (rename(playlist->control_filename, |
2844 | current_playlist.control_filename) < 0) | 2848 | current_playlist.control_filename) < 0) |
2845 | return -1; | 2849 | return -1; |
@@ -2888,14 +2892,20 @@ void playlist_close(struct playlist_info* playlist) | |||
2888 | if (!playlist) | 2892 | if (!playlist) |
2889 | return; | 2893 | return; |
2890 | 2894 | ||
2891 | if (playlist->fd >= 0) | 2895 | if (playlist->fd >= 0) { |
2892 | close(playlist->fd); | 2896 | close(playlist->fd); |
2897 | playlist->fd = -1; | ||
2898 | } | ||
2893 | 2899 | ||
2894 | if (playlist->control_fd >= 0) | 2900 | if (playlist->control_fd >= 0) { |
2895 | close(playlist->control_fd); | 2901 | close(playlist->control_fd); |
2902 | playlist->control_fd = -1; | ||
2903 | } | ||
2896 | 2904 | ||
2897 | if (playlist->control_created) | 2905 | if (playlist->control_created) { |
2898 | remove(playlist->control_filename); | 2906 | remove(playlist->control_filename); |
2907 | playlist->control_created = false; | ||
2908 | } | ||
2899 | } | 2909 | } |
2900 | 2910 | ||
2901 | void playlist_sync(struct playlist_info* playlist) | 2911 | void playlist_sync(struct playlist_info* playlist) |
@@ -3552,6 +3562,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) | |||
3552 | 3562 | ||
3553 | /* Replace the current playlist with the new one and update indices */ | 3563 | /* Replace the current playlist with the new one and update indices */ |
3554 | close(playlist->fd); | 3564 | close(playlist->fd); |
3565 | playlist->fd = -1; | ||
3555 | if (remove(playlist->filename) >= 0) | 3566 | if (remove(playlist->filename) >= 0) |
3556 | { | 3567 | { |
3557 | if (rename(path, playlist->filename) >= 0) | 3568 | if (rename(path, playlist->filename) >= 0) |