Skip to content

Commit

Permalink
fix(userspace): fix broken outputs when using -d daemonize option
Browse files Browse the repository at this point in the history
Symptoms included the message queue filling up without popping any messages
even though events were handled normally.

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
  • Loading branch information
incertum committed Jul 8, 2023
1 parent 8d68952 commit fd7d018
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions userspace/falco/app/actions/daemonize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ falco::app::run_result falco::app::actions::daemonize(falco::app::state& s)
// error
return run_result::fatal("Could not fork");
} else if (pid > 0) {
// parent. Write child pid to pidfile and exit
// parent. Write child pid to pidfile.
std::ofstream pidfile;
pidfile.open(s.options.pidfilename);

Expand All @@ -54,11 +54,10 @@ falco::app::run_result falco::app::actions::daemonize(falco::app::state& s)
}
pidfile << pid;
pidfile.close();
exit(0);
}
// if here, child.

// Become own process group.
// Become own session.
sid = setsid();
if (sid < 0) {
return run_result::fatal("Could not set session id");
Expand Down

0 comments on commit fd7d018

Please sign in to comment.