Alan Jenkins 50463a6a10 Daemonize(): use one error convention, not three
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.
2018-08-25 10:07:02 +01:00
..
2018-08-25 09:54:55 +01:00
2018-08-13 15:27:05 +02:00
2018-08-13 15:27:05 +02:00
2018-08-13 15:27:05 +02:00
2018-08-13 13:44:31 +02:00
2018-08-13 15:27:05 +02:00
2018-01-11 13:29:11 +01:00