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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 18 17:38:45 CEST 2009


Author: mattm
Date: 2009-05-18 17:38:45 +0200 (Mon, 18 May 2009)
New Revision: 3408

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
   trunk/openvas-manager/src/tasks_sql.h
Log:
	* src/omp.c (init_omp): Doc return.

	* src/tasks_sql.h (init_manage): Return -1 on error instead of
	aborting.

	* ChangeLog: Add heading to last log.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-18 15:20:51 UTC (rev 3407)
+++ trunk/openvas-manager/ChangeLog	2009-05-18 15:38:45 UTC (rev 3408)
@@ -1,5 +1,16 @@
 2009-05-18  Matthew Mundell <mmundell at intevation.de>
 
+	* src/omp.c (init_omp): Doc return.
+
+	* src/tasks_sql.h (init_manage): Return -1 on error instead of
+	aborting.
+
+	* ChangeLog: Add heading to last log.
+
+2009-05-18  Matthew Mundell <mmundell at intevation.de>
+
+	Ensure that task statuses are consistent on startup.
+
 	* src/openvasmd.c (main): Call init_ompd.
 
 	* src/tasks_sql.h (init_manage_process): New function, was init_manage.

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2009-05-18 15:20:51 UTC (rev 3407)
+++ trunk/openvas-manager/src/omp.c	2009-05-18 15:38:45 UTC (rev 3408)
@@ -1767,6 +1767,8 @@
 
 /**
  * @brief Initialise OMP library.
+ *
+ * @return 0 on success, else -1.
  */
 int
 init_omp ()

Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h	2009-05-18 15:20:51 UTC (rev 3407)
+++ trunk/openvas-manager/src/tasks_sql.h	2009-05-18 15:38:45 UTC (rev 3408)
@@ -362,7 +362,7 @@
  * Beware that calling this function while tasks are running may lead to
  * problems.
  *
- * @return 0.
+ * @return 0 on success, else -1.
  */
 int
 init_manage ()
@@ -382,7 +382,7 @@
     {
       fprintf (stderr, "sqlite3_prepare 1 failed: %s\n",
                sqlite3_errmsg (task_db));
-      abort ();
+      return -1;
     }
   while (1)
     {
@@ -396,7 +396,7 @@
           if (ret == SQLITE_ERROR) ret = sqlite3_reset (stmt);
           fprintf (stderr, "sqlite3_step 1 failed: %s\n",
                    sqlite3_errmsg (task_db));
-          abort ();
+          return -1;
         }
       name = sqlite3_column_text (stmt, 0);
       tracef ("   table %s\n", name);
@@ -428,9 +428,11 @@
           current_credentials.username = NULL;
         }
     }
-  sqlite3_finalize (stmt);
-
-  return 0;
+  switch (sqlite3_finalize (stmt))
+    {
+      case SQLITE_OK: return 0;
+      default: return -1;
+    }
 }
 
 /**



More information about the Openvas-commits mailing list