summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 2b2881a9b8..84e8875968 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1491,6 +1491,7 @@ static bool update_master_header(void)
1491 1491
1492 myhdr.serial = current_tcmh.serial; 1492 myhdr.serial = current_tcmh.serial;
1493 myhdr.commitid = current_tcmh.commitid; 1493 myhdr.commitid = current_tcmh.commitid;
1494 myhdr.dirty = current_tcmh.dirty;
1494 1495
1495 /* Write it back */ 1496 /* Write it back */
1496 lseek(fd, 0, SEEK_SET); 1497 lseek(fd, 0, SEEK_SET);
@@ -1502,6 +1503,7 @@ static bool update_master_header(void)
1502 { 1503 {
1503 hdr->h.serial = current_tcmh.serial; 1504 hdr->h.serial = current_tcmh.serial;
1504 hdr->h.commitid = current_tcmh.commitid; 1505 hdr->h.commitid = current_tcmh.commitid;
1506 hdr->h.dirty = current_tcmh.dirty;
1505 } 1507 }
1506#endif 1508#endif
1507 1509
@@ -2902,10 +2904,9 @@ static bool commit(void)
2902 { 2904 {
2903 close(tmpfd); 2905 close(tmpfd);
2904 logf("tagcache failed init"); 2906 logf("tagcache failed init");
2905 if (ret < 0) 2907 if (ret == 0)
2906 remove_files();
2907 else
2908 tc_stat.commit_delayed = true; 2908 tc_stat.commit_delayed = true;
2909
2909 tc_stat.commit_step = 0; 2910 tc_stat.commit_step = 0;
2910 read_lock--; 2911 read_lock--;
2911 return false; 2912 return false;
@@ -2916,13 +2917,14 @@ static bool commit(void)
2916 { 2917 {
2917 logf("Failure to commit numeric indices"); 2918 logf("Failure to commit numeric indices");
2918 close(tmpfd); 2919 close(tmpfd);
2919 remove_files();
2920 tc_stat.commit_step = 0; 2920 tc_stat.commit_step = 0;
2921 read_lock--; 2921 read_lock--;
2922 return false; 2922 return false;
2923 } 2923 }
2924 2924
2925 close(tmpfd); 2925 close(tmpfd);
2926 remove(TAGCACHE_FILE_TEMP);
2927
2926 tc_stat.commit_step = 0; 2928 tc_stat.commit_step = 0;
2927 2929
2928 /* Update the master index headers. */ 2930 /* Update the master index headers. */
@@ -2944,7 +2946,6 @@ static bool commit(void)
2944 close(masterfd); 2946 close(masterfd);
2945 2947
2946 logf("tagcache committed"); 2948 logf("tagcache committed");
2947 remove(TAGCACHE_FILE_TEMP);
2948 tc_stat.ready = check_all_headers(); 2949 tc_stat.ready = check_all_headers();
2949 tc_stat.readyvalid = true; 2950 tc_stat.readyvalid = true;
2950 2951