Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bb12522: Fix freshclam db test in daemon mode
Database validation was broken when running daemon mode.
The source of this bug was a mistake when overhauling freshclam.
The freshclam overhaul accidentally removed the call to disable
waiting for child processes in the global signal handler.
This patch fixes the issue by disabling the wait prior to the
fork to test the database.
  • Loading branch information
micahsnyder committed Jan 27, 2021
1 parent 4216c6a commit ade9352
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions freshclam/freshclam.c
Expand Up @@ -281,6 +281,14 @@ fc_error_t download_complete_callback(const char *dbFilename, void *context)
goto done;
}
} else {
/*
* Attempt to test database in a child process.
*/

/* We need to be able to wait for the child process ourselves.
* We'll re-enable wait in the global handler when we're done. */
g_sigchildWait = 0;

switch (pid = fork()) {
case -1: {
/*
Expand Down Expand Up @@ -392,6 +400,7 @@ fc_error_t download_complete_callback(const char *dbFilename, void *context)
logg("!Database test FAILED.\n");
}

/* Re-enable the global handler's child process wait */
g_sigchildWait = 1;

return status;
Expand Down

0 comments on commit ade9352

Please sign in to comment.