Skip to content

Commit

Permalink
Set run status only after getting OSP scan
Browse files Browse the repository at this point in the history
This addresses issues with the start time being undefined while the
status is already set to "Running", e.g. during sensor scans.
  • Loading branch information
timopollmeier committed Jan 21, 2020
1 parent 3d1cf47 commit cab0f2a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -3560,6 +3560,7 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id)
char *host, *ca_pub, *key_pub, *key_priv;
int rc, port;
scanner_t scanner;
gboolean started = FALSE;

scanner = task_scanner (task);
host = scanner_host (scanner);
Expand Down Expand Up @@ -3642,6 +3643,13 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id)
rc = 0;
break;
}
else if (osp_scan_status == OSP_SCAN_STATUS_RUNNING
&& started == FALSE)
{
set_task_run_status (task, TASK_STATUS_RUNNING);
set_report_scan_run_status (global_current_report,
TASK_STATUS_RUNNING);
}
}
}
}
Expand Down Expand Up @@ -4502,9 +4510,6 @@ fork_osp_scan_handler (task_t task, target_t target, int from,
exit (-1);
}

set_task_run_status (task, TASK_STATUS_RUNNING);
set_report_scan_run_status (global_current_report, TASK_STATUS_RUNNING);

snprintf (title, sizeof (title), "gvmd: OSP: Handling scan %s", report_id);
proctitle_set (title);

Expand Down

0 comments on commit cab0f2a

Please sign in to comment.