stream-restore: make version check stricter when dropping old entries

If we increment ENTRY_VERSION in the future, the old code would drop
entries with version 2, but we only want to drop entries with version 1.

This issue was spotted by Igor Kovalenko:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/298#note_983365

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/604>
This commit is contained in:
Tanu Kaskinen 2021-07-09 12:32:27 +03:00
parent 02cc1f8b91
commit 13fd21a9c9

View file

@ -1175,7 +1175,7 @@ static struct entry *entry_read(struct userdata *u, const char *name) {
pa_datum_free(&data);
#ifdef STREAM_RESTORE_CLEAR_OLD_DEVICES
if (version < ENTRY_VERSION && e->device_valid) {
if (version < 2 && e->device_valid) {
/* Prior to PulseAudio 14.0, GNOME's sound settings overwrote the
* routing for all entries in the stream-restore database when
* selecting a device. PulseAudio 14.0 prevents that from happening,