mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
Not quite a fix for FS#12693 yet, but at least invalidate the playlist file descriptors after closing and removing
Change-Id: Ia43eb517d154d24a6bd581fa3aa69c99a28228ae
This commit is contained in:
parent
7292254053
commit
beb61a93c5
1 changed files with 14 additions and 3 deletions
|
|
@ -2049,6 +2049,7 @@ void playlist_shutdown(void)
|
||||||
flush_cached_control(playlist);
|
flush_cached_control(playlist);
|
||||||
|
|
||||||
close(playlist->control_fd);
|
close(playlist->control_fd);
|
||||||
|
playlist->control_fd = -1;
|
||||||
|
|
||||||
mutex_unlock(playlist->control_mutex);
|
mutex_unlock(playlist->control_mutex);
|
||||||
}
|
}
|
||||||
|
|
@ -2838,8 +2839,11 @@ int playlist_set_current(struct playlist_info* playlist)
|
||||||
current_playlist.fd = playlist->fd;
|
current_playlist.fd = playlist->fd;
|
||||||
|
|
||||||
close(playlist->control_fd);
|
close(playlist->control_fd);
|
||||||
|
playlist->control_fd = -1;
|
||||||
close(current_playlist.control_fd);
|
close(current_playlist.control_fd);
|
||||||
|
current_playlist.control_fd = -1;
|
||||||
remove(current_playlist.control_filename);
|
remove(current_playlist.control_filename);
|
||||||
|
current_playlist.control_created = false;
|
||||||
if (rename(playlist->control_filename,
|
if (rename(playlist->control_filename,
|
||||||
current_playlist.control_filename) < 0)
|
current_playlist.control_filename) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -2888,14 +2892,20 @@ void playlist_close(struct playlist_info* playlist)
|
||||||
if (!playlist)
|
if (!playlist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (playlist->fd >= 0)
|
if (playlist->fd >= 0) {
|
||||||
close(playlist->fd);
|
close(playlist->fd);
|
||||||
|
playlist->fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (playlist->control_fd >= 0)
|
if (playlist->control_fd >= 0) {
|
||||||
close(playlist->control_fd);
|
close(playlist->control_fd);
|
||||||
|
playlist->control_fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (playlist->control_created)
|
if (playlist->control_created) {
|
||||||
remove(playlist->control_filename);
|
remove(playlist->control_filename);
|
||||||
|
playlist->control_created = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void playlist_sync(struct playlist_info* playlist)
|
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 */
|
/* Replace the current playlist with the new one and update indices */
|
||||||
close(playlist->fd);
|
close(playlist->fd);
|
||||||
|
playlist->fd = -1;
|
||||||
if (remove(playlist->filename) >= 0)
|
if (remove(playlist->filename) >= 0)
|
||||||
{
|
{
|
||||||
if (rename(path, playlist->filename) >= 0)
|
if (rename(path, playlist->filename) >= 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue