diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-05-19 16:30:32 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-05-19 16:30:32 -0400 |
commit | 3ed035769c53d1b8957535c6e6bd8a2e56058d80 (patch) | |
tree | 02ef6f10981e688dfe1339e55f9474401a87a23e | |
parent | 0c4c1e60428c28b30a5f1c151b6691b2171cff7f (diff) | |
download | rockbox-3ed035769c53d1b8957535c6e6bd8a2e56058d80.tar.gz rockbox-3ed035769c53d1b8957535c6e6bd8a2e56058d80.zip |
FS#9093: Database initialization hangs if there's no music file on the player
Original patch by William Poetra Yoga Hadisoeseno
Change-Id: I198a4d1b2899bd9200a35dbefd034a2e9857fa19
-rw-r--r-- | apps/tagcache.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index bff1550059..e6a4e8e3c4 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -2239,7 +2239,7 @@ static bool build_numeric_indices(struct tagcache_header *h, int tmpfd) | |||
2239 | 2239 | ||
2240 | masterfd_pos = lseek(masterfd, tcmh.tch.entry_count * sizeof(struct index_entry), | 2240 | masterfd_pos = lseek(masterfd, tcmh.tch.entry_count * sizeof(struct index_entry), |
2241 | SEEK_CUR); | 2241 | SEEK_CUR); |
2242 | if (masterfd_pos == filesize(masterfd)) | 2242 | if (masterfd_pos < 0) |
2243 | { | 2243 | { |
2244 | logf("we can't append!"); | 2244 | logf("we can't append!"); |
2245 | close(masterfd); | 2245 | close(masterfd); |
@@ -2988,12 +2988,7 @@ static bool commit(void) | |||
2988 | } | 2988 | } |
2989 | 2989 | ||
2990 | if (tch.entry_count == 0) | 2990 | if (tch.entry_count == 0) |
2991 | { | ||
2992 | logf("nothing to commit"); | 2991 | logf("nothing to commit"); |
2993 | close(tmpfd); | ||
2994 | remove(TAGCACHE_FILE_TEMP); | ||
2995 | return true; | ||
2996 | } | ||
2997 | 2992 | ||
2998 | /* Fully initialize existing headers (if any) before going further. */ | 2993 | /* Fully initialize existing headers (if any) before going further. */ |
2999 | tc_stat.ready = check_all_headers(); | 2994 | tc_stat.ready = check_all_headers(); |