FS#9093: Database initialization hangs if there's no music file on the player

Original patch by William Poetra Yoga Hadisoeseno

Change-Id: I198a4d1b2899bd9200a35dbefd034a2e9857fa19
This commit is contained in:
Solomon Peachy 2021-05-19 16:30:32 -04:00
parent 0c4c1e6042
commit 3ed035769c
1 changed files with 1 additions and 6 deletions

View File

@ -2239,7 +2239,7 @@ static bool build_numeric_indices(struct tagcache_header *h, int tmpfd)
masterfd_pos = lseek(masterfd, tcmh.tch.entry_count * sizeof(struct index_entry),
SEEK_CUR);
if (masterfd_pos == filesize(masterfd))
if (masterfd_pos < 0)
{
logf("we can't append!");
close(masterfd);
@ -2988,12 +2988,7 @@ static bool commit(void)
}
if (tch.entry_count == 0)
{
logf("nothing to commit");
close(tmpfd);
remove(TAGCACHE_FILE_TEMP);
return true;
}
/* Fully initialize existing headers (if any) before going further. */
tc_stat.ready = check_all_headers();