dovecot-1.1: sqlite crashed with dict server. Patch by Bernhard ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 22 01:15:19 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/c5292984a0c1
changeset: 7826:c5292984a0c1
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 22 01:14:11 2008 +0300
description:
sqlite crashed with dict server. Patch by Bernhard Herzog.

diffstat:

1 file changed, 15 insertions(+), 6 deletions(-)
src/lib-sql/driver-sqlite.c |   21 +++++++++++++++------

diffs (41 lines):

diff -r 155d4e597397 -r c5292984a0c1 src/lib-sql/driver-sqlite.c
--- a/src/lib-sql/driver-sqlite.c	Thu Aug 21 07:36:40 2008 +0300
+++ b/src/lib-sql/driver-sqlite.c	Fri Aug 22 01:14:11 2008 +0300
@@ -124,6 +124,9 @@ static void driver_sqlite_exec(struct sq
 {
 	struct sqlite_db *db = (struct sqlite_db *)_db;
 
+	if (driver_sqlite_connect(_db) < 0)
+		return;
+
 	db->rc = sqlite3_exec(db->sqlite, query, NULL, NULL, NULL);
 	if (db->rc != SQLITE_OK) {
 		i_error("sqlite: exec(%s) failed: %s (%d)",
@@ -152,15 +155,21 @@ driver_sqlite_query_s(struct sql_db *_db
 
 	result = i_new(struct sqlite_result, 1);
 
-	rc = sqlite3_prepare(db->sqlite, query, -1, &result->stmt, NULL);
-	if (rc == SQLITE_OK) {
-		result->api = driver_sqlite_result;
-		result->cols = sqlite3_column_count(result->stmt);
-		result->row = i_new(const char *, result->cols);
-	} else {
+	if (driver_sqlite_connect(_db) < 0) {
 		result->api = driver_sqlite_error_result;
 		result->stmt = NULL;
 		result->cols = 0;
+	} else {
+		rc = sqlite3_prepare(db->sqlite, query, -1, &result->stmt, NULL);
+		if (rc == SQLITE_OK) {
+			result->api = driver_sqlite_result;
+			result->cols = sqlite3_column_count(result->stmt);
+			result->row = i_new(const char *, result->cols);
+		} else {
+			result->api = driver_sqlite_error_result;
+			result->stmt = NULL;
+			result->cols = 0;
+		}
 	}
 	result->api.db = _db;
 


More information about the dovecot-cvs mailing list