Correct handling of reaper thread in forking binaries

This commit is contained in:
Thulinma 2021-03-19 22:36:27 +01:00
parent 5f8518fe23
commit dbafdf6744
5 changed files with 36 additions and 7 deletions

View file

@ -596,10 +596,10 @@ int main(int argc, char **argv){
Controller::conf.activate();
uint64_t reTimer = 0;
while (Controller::conf.is_active){
Util::Procs::fork_prepare();
pid_t pid = fork();
if (pid == 0){
Util::Procs::handler_set = false;
Util::Procs::reaper_thread = 0;
Util::Procs::fork_complete();
{
struct sigaction new_action;
new_action.sa_sigaction = handleUSR1;
@ -609,6 +609,7 @@ int main(int argc, char **argv){
}
return main_loop(argc, argv);
}
Util::Procs::fork_complete();
if (pid == -1){
FAIL_MSG("Unable to spawn controller process!");
return 2;