[tracker] libtracker-data: Make verify_last succeed on an empty data journal file
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Make verify_last succeed on an empty data journal file
- Date: Mon, 25 Oct 2010 12:54:23 +0000 (UTC)
commit f51f78c6a052064dd4efb0ec3db25917f78f19b0
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Oct 13 17:26:35 2010 +0200
libtracker-data: Make verify_last succeed on an empty data journal file
src/libtracker-data/tracker-db-journal.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index bcb168e..859dde0 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -1654,18 +1654,23 @@ tracker_db_journal_reader_verify_last (const gchar *filename,
JournalReader jreader = { 0 };
if (db_journal_reader_init (&jreader, FALSE, filename)) {
- entry_size_check = read_uint32 (jreader.end - 4);
- if (jreader.end - entry_size_check < jreader.current) {
- g_set_error (error, TRACKER_DB_JOURNAL_ERROR, 0,
- "Damaged journal entry at end of journal");
+ if (jreader.end != jreader.current) {
+ entry_size_check = read_uint32 (jreader.end - 4);
+
+ if (jreader.end - entry_size_check < jreader.current) {
+ g_set_error (error, TRACKER_DB_JOURNAL_ERROR, 0,
+ "Damaged journal entry at end of journal");
+ db_journal_reader_shutdown (&jreader);
+ return FALSE;
+ }
+
+ jreader.current = jreader.end - entry_size_check;
+ success = db_journal_reader_next (&jreader, FALSE, NULL);
db_journal_reader_shutdown (&jreader);
- return FALSE;
+ } else {
+ success = TRUE;
}
-
- jreader.current = jreader.end - entry_size_check;
- success = db_journal_reader_next (&jreader, FALSE, NULL);
- db_journal_reader_shutdown (&jreader);
}
return success;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]