mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Standardize on exit() / _exit() (this depends whether we are considered to be the "main" fork, which should run anything registered with atexit()). Exclude `return false` and throwing exceptions. This fixes the error path for fork(). Daemonize() would return false, but the `return false` error convention was not tested in the caller. It also fixes the error message for fork() to show the error code. Everyone loves `strace`, but sysadmins should not have to rerun their daemons under it just to see an error code. Also in case an exception is thrown, show its diagnostic information instead of dropping it on the floor. In the log message, I mention why we are uninitializing and then initializing the app at this point. For the reader, it pushes all the weirdness into the error convention of Daemonize(). This comes back to the exit() / _exit() distinction. Once we have forked, we technically don't want to allow the parent process to exit(), so we don't want to return to the caller.