]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sql: driver-sqlite - Explicitly initialize sqlite3
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 30 Sep 2025 11:30:09 +0000 (14:30 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 20 Oct 2025 16:59:30 +0000 (19:59 +0300)
This allows catching initialization errors early

src/lib-sql/driver-sqlite.c

index 0d789f9ab9a3123234f4c8f5561b273e6e5c16ee..6d1f825728349324a729e2207bd65090ee251146 100644 (file)
@@ -770,6 +770,9 @@ void driver_sqlite_init(void)
 {
        i_array_init(&sqlite_db_cache, 4);
        sql_driver_register(&driver_sqlite_db);
+       int rc = sqlite3_initialize();
+       if (rc != SQLITE_OK)
+               i_fatal("Cannot initialize sqlite: %s", sqlite3_errstr(rc));
 }
 
 void driver_sqlite_deinit(void)
@@ -782,6 +785,7 @@ void driver_sqlite_deinit(void)
        }
        array_free(&sqlite_db_cache);
        sql_driver_unregister(&driver_sqlite_db);
+       sqlite3_shutdown();
 }
 
 #endif