summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2009-04-15 06:46:25 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2009-04-15 06:46:25 +0000
commita1614508221a2ce453e1ac306293ba981eb41330 (patch)
tree0ebb74b6b1fe707b7e0fbdf398753f85c91b795b /apps
parentbf37ecb6b8fe46e203db844553f65d0a1ba02d95 (diff)
downloadrockbox-a1614508221a2ce453e1ac306293ba981eb41330.zip
rockbox-a1614508221a2ce453e1ac306293ba981eb41330.tar.gz
rockbox-a1614508221a2ce453e1ac306293ba981eb41330.tar.bz2
rockbox-a1614508221a2ce453e1ac306293ba981eb41330.tar.xz
Handle the DB dirty flag correctly. Now a broken DB should stay disabled. Also don't remove broken files automatically. Should improve (or even fix) the duplicate entry issue seen in FS#8414 when the problem is caused by the player shutting down in the middle of a DB commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20710 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 2b2881a..84e8875 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1491,6 +1491,7 @@ static bool update_master_header(void)
myhdr.serial = current_tcmh.serial;
myhdr.commitid = current_tcmh.commitid;
+ myhdr.dirty = current_tcmh.dirty;
/* Write it back */
lseek(fd, 0, SEEK_SET);
@@ -1502,6 +1503,7 @@ static bool update_master_header(void)
{
hdr->h.serial = current_tcmh.serial;
hdr->h.commitid = current_tcmh.commitid;
+ hdr->h.dirty = current_tcmh.dirty;
}
#endif
@@ -2902,10 +2904,9 @@ static bool commit(void)
{
close(tmpfd);
logf("tagcache failed init");
- if (ret < 0)
- remove_files();
- else
+ if (ret == 0)
tc_stat.commit_delayed = true;
+
tc_stat.commit_step = 0;
read_lock--;
return false;
@@ -2916,13 +2917,14 @@ static bool commit(void)
{
logf("Failure to commit numeric indices");
close(tmpfd);
- remove_files();
tc_stat.commit_step = 0;
read_lock--;
return false;
}
close(tmpfd);
+ remove(TAGCACHE_FILE_TEMP);
+
tc_stat.commit_step = 0;
/* Update the master index headers. */
@@ -2944,7 +2946,6 @@ static bool commit(void)
close(masterfd);
logf("tagcache committed");
- remove(TAGCACHE_FILE_TEMP);
tc_stat.ready = check_all_headers();
tc_stat.readyvalid = true;