Properly log errors when setting up daemon FDs
authorIustin Pop <iustin@google.com>
Tue, 6 Nov 2012 14:23:34 +0000 (15:23 +0100)
committerIustin Pop <iustin@google.com>
Tue, 20 Nov 2012 10:12:54 +0000 (11:12 +0100)
commit1a865afe5bdd78bfd2023e6b07a5820abf2949ab
treeffdc4fbe426e18bae1f87a50b87dde0bcaed9c59
parent8ee2994a87f1bfc41e5d2f62723c39b67b0a37e1
Properly log errors when setting up daemon FDs

While writing the pipe-based reporting and trying various ways to
break the startup, I fought for a while trying to understand why error
reporting was _different_ when running the daemon as a user (with no
rights). It turns out that setupDaemonFDs wants to open the log file
in append mode way before, so we are not protected by the 'prepare'
phase.

This patch explicitly runs the 'setupDaemonFDs' function under the
same handler as the prepare phase, with the only change that here we
instruct handlePrepErr to not log the message via log*, since logging
is not yet set up.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
htools/Ganeti/Daemon.hs