[Openvas-commits] r11613 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 14 15:59:33 CEST 2011


Author: mattm
Date: 2011-09-14 15:59:31 +0200 (Wed, 14 Sep 2011)
New Revision: 11613

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (sql): Check for SQLITE_LOCKED after sqlite3_prepare.
	After sqlite3_step check if the reset return is BUSY or LOCKED.
	(cleanup_manage_process): Remove DETACH scap.  Seems to result in blocking
	failures in error cases when run in sigabrt.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-09-14 11:31:57 UTC (rev 11612)
+++ trunk/openvas-manager/ChangeLog	2011-09-14 13:59:31 UTC (rev 11613)
@@ -1,5 +1,12 @@
 2011-09-13  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/manage_sql.c (sql): Check for SQLITE_LOCKED after sqlite3_prepare.
+	After sqlite3_step check if the reset return is BUSY or LOCKED.
+	(cleanup_manage_process): Remove DETACH scap.  Seems to result in blocking
+	failures in error cases when run in sigabrt.
+
+2011-09-13  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	* src/manage_sql.c (init_manage_process): Uppercase SQL keyword.
 	(cleanup_manage_process): DETACH scap.
 

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2011-09-14 11:31:57 UTC (rev 11612)
+++ trunk/openvas-manager/src/manage_sql.c	2011-09-14 13:59:31 UTC (rev 11613)
@@ -376,7 +376,8 @@
   while (1)
     {
       ret = sqlite3_prepare (task_db, (char*) formatted, -1, &stmt, &tail);
-      if (ret == SQLITE_BUSY) continue;
+      if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
+        continue;
       g_free (formatted);
       if (ret == SQLITE_OK)
         {
@@ -404,7 +405,12 @@
       if (ret == SQLITE_DONE) break;
       if (ret == SQLITE_ERROR || ret == SQLITE_MISUSE)
         {
-          if (ret == SQLITE_ERROR) ret = sqlite3_reset (stmt);
+          if (ret == SQLITE_ERROR)
+            {
+              ret = sqlite3_reset (stmt);
+              if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
+                continue;
+            }
           g_warning ("%s: sqlite3_step failed: %s\n",
                      __FUNCTION__,
                      sqlite3_errmsg (task_db));
@@ -8460,8 +8466,6 @@
     {
       if (cleanup && current_scanner_task)
         set_task_run_status (current_scanner_task, TASK_STATUS_STOPPED);
-      if (scap_loaded)
-        sql ("DETACH DATABASE scap;");
       sqlite3_close (task_db);
       task_db = NULL;
     }



More information about the Openvas-commits mailing list