aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-12-19 20:06:27 +0000
committerChristian Grothoff <christian@grothoff.org>2010-12-19 20:06:27 +0000
commite333599ab88c1ec1c8de83afc32a8c55911de0d2 (patch)
tree9252e6fe76cb8012c4bdbcbfa960e6d75fa44b52 /src/datacache
parent6652156e7d7083205b68d5fc73a085b88e662d96 (diff)
downloadgnunet-e333599ab88c1ec1c8de83afc32a8c55911de0d2.tar.gz
gnunet-e333599ab88c1ec1c8de83afc32a8c55911de0d2.zip
fix
Diffstat (limited to 'src/datacache')
-rw-r--r--src/datacache/plugin_datacache_sqlite.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index e3f0dcb24..1e293a4ba 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -423,6 +423,8 @@ libgnunet_plugin_datacache_sqlite_done (void *cls)
423{ 423{
424 struct GNUNET_DATACACHE_PluginFunctions *api = cls; 424 struct GNUNET_DATACACHE_PluginFunctions *api = cls;
425 struct Plugin *plugin = api->cls; 425 struct Plugin *plugin = api->cls;
426 int result;
427 sqlite3_stmt *stmt;
426 428
427#if !WINDOWS || defined(__CYGWIN__) 429#if !WINDOWS || defined(__CYGWIN__)
428 if (0 != UNLINK (plugin->fn)) 430 if (0 != UNLINK (plugin->fn))
@@ -431,7 +433,37 @@ libgnunet_plugin_datacache_sqlite_done (void *cls)
431 plugin->fn); 433 plugin->fn);
432 GNUNET_free (plugin->fn); 434 GNUNET_free (plugin->fn);
433#endif 435#endif
434 sqlite3_close (plugin->dbh); 436 result = sqlite3_close (plugin->dbh);
437#if SQLITE_VERSION_NUMBER >= 3007000
438 if (result == SQLITE_BUSY)
439 {
440 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
441 "sqlite",
442 _("Tried to close sqlite without finalizing all prepared statements.\n"));
443 stmt = sqlite3_next_stmt(plugin->dbh, NULL);
444 while (stmt != NULL)
445 {
446#if DEBUG_SQLITE
447 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
448 "sqlite", "Closing statement %p\n", stmt);
449#endif
450 result = sqlite3_finalize(stmt);
451#if DEBUG_SQLITE
452 if (result != SQLITE_OK)
453 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
454 "sqlite",
455 "Failed to close statement %p: %d\n", stmt, result);
456#endif
457 stmt = sqlite3_next_stmt(plugin->dbh, NULL);
458 }
459 result = sqlite3_close(plugin->dbh);
460 }
461#endif
462 if (SQLITE_OK != result)
463 LOG_SQLITE (plugin->dbh,
464 GNUNET_ERROR_TYPE_ERROR,
465 "sqlite3_close");
466
435#if WINDOWS && !defined(__CYGWIN__) 467#if WINDOWS && !defined(__CYGWIN__)
436 if (0 != UNLINK (plugin->fn)) 468 if (0 != UNLINK (plugin->fn))
437 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, 469 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,