]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] critical errors should be reported even in daemon mode
authorWilly Tarreau <w@1wt.eu>
Sun, 16 Nov 2008 06:40:34 +0000 (07:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 7 Dec 2008 22:37:28 +0000 (23:37 +0100)
Josh Goebel reported that haproxy silently dies when it fails to
chroot. In fact, it does so when in daemon mode, because daemon
mode has been disabling output for ages.

Since the code has been reworked, this could have been changed
because there is no reason for this anymore, hence this patch.
(cherry picked from commit 304d6fb00fe32fca1bd932a301d4afb7d54c92bc)
(cherry picked from commit 50b7f7f12c67322c793f50a6be009f0fd0eec1bb)

src/haproxy.c

index 261a4be49bc21489d8fe6ddcbe00336b20bcb9a5..48b76ba672bbe8e377c3451dd7e480cac4d72d1c 100644 (file)
@@ -937,11 +937,6 @@ int main(int argc, char **argv)
        signal(SIGTTOU, sig_pause);
        signal(SIGTTIN, sig_listen);
 
-       if (global.mode & MODE_DAEMON) {
-               global.mode &= ~MODE_VERBOSE;
-               global.mode |= MODE_QUIET;
-       }
-
        /* MODE_QUIET can inhibit alerts and warnings below this line */
 
        global.mode &= ~MODE_STARTING;
@@ -1103,10 +1098,11 @@ int main(int argc, char **argv)
                 * it would have already be done, and 0-2 would have been affected to listening
                 * sockets
                 */
-               if (!(global.mode & MODE_QUIET)) {
+               if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
                        /* detach from the tty */
                        fclose(stdin); fclose(stdout); fclose(stderr);
                        close(0); close(1); close(2); /* close all fd's */
+                       global.mode &= ~MODE_VERBOSE;
                        global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
                }
                pid = getpid(); /* update child's pid */