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:
Bertrik Sikken 2012-06-13 00:55:32 +02:00
parent 7292254053
commit beb61a93c5

View file

@ -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)