1
0
Fork 0
forked from len0rd/rockbox

tagcache: Don't try to look up "deleted" filename entries

When a file is deleted from the database, the first character of that entry
is changed to \0.  However the entry's length is not updated,
because the entry is still using space in the index.

When checking for deleted files, we were only keying on "length == 0"
instead of also checking to see if the entry itself starts with \0.

Change-Id: Ic00a0b29c3857c597ee5ff6ec01a5f4fd9633447
This commit is contained in:
Solomon Peachy 2025-08-13 11:04:07 -04:00
parent 01860627bd
commit 80eca90481

View file

@ -503,7 +503,7 @@ read_tagfile_entry_and_tag(int fd, struct tagfile_entry *tfe,
return e_TAG_SIZEMISMATCH; return e_TAG_SIZEMISMATCH;
str_setlen(buf, tag_length); str_setlen(buf, tag_length);
return tag_length > 0 ? e_SUCCESS : e_SUCCESS_LEN_ZERO; return (tag_length > 0 && *buf) ? e_SUCCESS : e_SUCCESS_LEN_ZERO;
} }
static ssize_t read_index_entries(int fd, struct index_entry *buf, size_t count) static ssize_t read_index_entries(int fd, struct index_entry *buf, size_t count)