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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 1 10:43:19 CEST 2009


Author: mattm
Date: 2009-07-01 10:43:18 +0200 (Wed, 01 Jul 2009)
New Revision: 3900

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
Log:
	* src/omp.c (omp_xml_handle_end_element): Account for 0 current_port in
	GET_STATUS progress calculation.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-07-01 08:08:00 UTC (rev 3899)
+++ trunk/openvas-manager/ChangeLog	2009-07-01 08:43:18 UTC (rev 3900)
@@ -1,5 +1,10 @@
 2009-07-01  Matthew Mundell <mmundell at intevation.de>
 
+	* src/omp.c (omp_xml_handle_end_element): Account for 0 current_port in
+	GET_STATUS progress calculation.
+
+2009-07-01  Matthew Mundell <mmundell at intevation.de>
+
 	Add a PROGRESS element to the GET_STATUS response.
 
 	* src/manage.c (task_last_report_id): Remove old comment.

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2009-07-01 08:08:00 UTC (rev 3899)
+++ trunk/openvas-manager/src/omp.c	2009-07-01 08:43:18 UTC (rev 3900)
@@ -2066,7 +2066,7 @@
                     char* name;
                     gchar *last_report_id, *last_report;
                     long progress;
-                    unsigned int max_port;
+                    unsigned int max_port, current_port;
 
                     last_report_id = task_last_report_id (tsk_uuid);
                     if (last_report_id)
@@ -2091,14 +2091,15 @@
                       last_report = g_strdup ("");
 
                     max_port = task_max_port (task);
+                    current_port = task_current_port (task);
                     if (max_port)
                       {
-                        progress = (task_current_port (task) * 100) / max_port;
+                        progress = (current_port * 100) / max_port;
                         if (progress < 0) progress = 0;
                         else if (progress > 100) progress = 100;
                       }
                     else
-                      progress = 100;
+                      progress = current_port ? 100 : 0;
 
                     name = task_name (task);
                     response = g_strdup_printf ("<get_status_response"
@@ -2175,17 +2176,18 @@
                 char* tsk_uuid;
                 gchar *last_report_id, *last_report;
                 long progress;
-                unsigned int max_port;
+                unsigned int max_port, current_port;
 
                 max_port = task_max_port (index);
+                current_port = task_current_port (index);
                 if (max_port)
                   {
-                    progress = (task_current_port (index) * 100) / max_port;
+                    progress = (current_port * 100) / max_port;
                     if (progress < 0) progress = 0;
                     else if (progress > 100) progress = 100;
                   }
                 else
-                  progress = 100;
+                  progress = current_port ? 100 : 0;
 
                 // FIX buffer entire response so this can respond on err
                 if (task_uuid (index, &tsk_uuid)) abort ();



More information about the Openvas-commits mailing list