[tracker] Fixes: NB#108361, Tracker crashing if commo.db is corrupt
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] Fixes: NB#108361, Tracker crashing if commo.db is corrupt
- Date: Fri, 24 Apr 2009 07:20:59 -0400 (EDT)
commit a13a710579887e405a668a826719be68bb58b999
Author: Ivan Frade <ivan frade nokia com>
Date: Thu Apr 16 13:55:20 2009 +0100
Fixes: NB#108361, Tracker crashing if commo.db is corrupt
---
src/libtracker-db/tracker-db-interface-sqlite.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 2126c8b..f78048e 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -597,19 +597,30 @@ create_result_set_from_stmt (TrackerDBInterfaceSqlite *interface,
}
if (result != SQLITE_DONE) {
-
g_hash_table_foreach (priv->statements, foreach_print_error, stmt);
- if (result == SQLITE_CORRUPT) {
+ /* This is rather fatal */
+ if (sqlite3_errcode (priv->db) == SQLITE_IOERR ||
+ sqlite3_errcode (priv->db) == SQLITE_CORRUPT ||
+ sqlite3_errcode (priv->db) == SQLITE_NOTADB) {
sqlite3_finalize (stmt);
sqlite3_close (priv->db);
+
g_unlink (priv->filename);
- g_error ("SQLite database:'%s' has been corrupted and removed, it will be recreated on restart, shutting down now",
- priv->filename);
+
+ g_error ("SQLite experienced an error with file:'%s'. "
+ "It is either NOT a SQLite database or it is "
+ "corrupt or there was an IO error accessing the data. "
+ "This file has now been removed and will be recreated on the next start. "
+ "Shutting down now.",
+ priv->filename);
+ return NULL;
}
if (!error) {
- g_warning ("%s", sqlite3_errmsg (priv->db));
+ g_warning ("Could not perform SQLite operation, error:%d->'%s'",
+ sqlite3_errcode (priv->db),
+ sqlite3_errmsg (priv->db));
} else {
g_set_error (error,
TRACKER_DB_INTERFACE_ERROR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]