Skip to content

Commit

Permalink
Add Changelog and fix format.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola committed Aug 6, 2021
1 parent ad3bd82 commit 0dbce72
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed
Fix interrupted scan, when the process table is full. [#832](https://github.com/greenbone/openvas-scanner/pull/832)

[21.4.3]: https://github.com/greenbone/openvas-scanner/compare/v21.4.2...gvmd-21.04

Expand Down
12 changes: 7 additions & 5 deletions src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ launch_plugin (struct scan_globals *globals, struct scheduler_plugin *plugin,
if (pid < 0)
{
plugin->running_state = PLUGIN_STATUS_UNRUN;
if (pid == ERR_NO_FREE_SLOT )
if (pid == ERR_NO_FREE_SLOT)
ret = ERR_NO_FREE_SLOT;
else
ret = ERR_CANT_FORK;
Expand Down Expand Up @@ -524,17 +524,19 @@ attack_host (struct scan_globals *globals, struct in6_addr *ip, GSList *vhosts,
}
else if (e == ERR_NO_FREE_SLOT)
{
g_debug ("fork() failed for %s. Not free slot to run a plugin.",
plugin->oid);
g_debug (
"fork() failed for %s. Not free slot to run a plugin.",
plugin->oid);
goto again;
}
else if (e == ERR_CANT_FORK)
{
if (forks_retry < MAX_FORK_RETRIES)
{
forks_retry++;
g_debug ("fork() failed for %s - sleeping %d seconds (%s)",
plugin->oid, forks_retry, strerror (errno));
g_debug (
"fork() failed for %s - sleeping %d seconds (%s)",
plugin->oid, forks_retry, strerror (errno));
fork_sleep (forks_retry);
goto again;
}
Expand Down
11 changes: 6 additions & 5 deletions src/pluginlaunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ simult_ports (const char *oid, const char *next_oid)
/**
* If another NVT with same port requirements is running, wait.
*
* @return ERR_NO_FREE_SLOT if MAX_PROCESSES are running, the index of the first free "slot"
* in the processes array otherwise.
* @return ERR_NO_FREE_SLOT if MAX_PROCESSES are running, the index of the first
* free "slot" in the processes array otherwise.
*/
static int
next_free_process (kb_t kb, struct scheduler_plugin *upcoming)
Expand Down Expand Up @@ -407,7 +407,7 @@ plugin_launch (struct scan_globals *globals, struct scheduler_plugin *plugin,
"probably because the parallel check is temporally disabled. "
"Current parallel checks: %d. Old parallel checks: %d",
max_running_processes, old_max_running_processes);
usleep(250000);
usleep (250000);
return ERR_NO_FREE_SLOT;
}

Expand Down Expand Up @@ -471,9 +471,10 @@ pluginlaunch_wait_for_free_process (kb_t kb)
* to timeout. */

if (num_running_processes >= max_running_processes)
g_debug ("%s. Number of running processes >= maximum running processes (%d >= %d). "
g_debug ("%s. Number of running processes >= maximum running processes (%d "
">= %d). "
"Waitting for free slot for processes.",
__func__, num_running_processes, max_running_processes);
__func__, num_running_processes, max_running_processes);

while (
(num_running_processes >= max_running_processes)
Expand Down

0 comments on commit 0dbce72

Please sign in to comment.