From: William Lallemand Date: Wed, 7 Jun 2017 13:04:47 +0000 (+0200) Subject: BUG/MEDIUM: misplaced exit and wrong exit code X-Git-Tag: v1.8-dev3~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1499b9b7efedf6162d3e4744993558c28bdca77c;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: misplaced exit and wrong exit code Commit cb11fd2 ("MEDIUM: mworker: wait mode on reload failure") introduced a regression, when HAProxy is used in daemon mode, it exits 1 after forking its children. HAProxy should exit(0), the exit(EXIT_FAILURE) was expected to be use when the master fail in master-worker mode. Thanks to Emmanuel Hocdet for reporting this bug. No backport needed. --- diff --git a/src/haproxy.c b/src/haproxy.c index 9cbb3d5cf6..d64058dab5 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2574,12 +2574,13 @@ int main(int argc, char **argv) if (global.mode & MODE_MWORKER) { protocol_unbind_all(); mworker_wait(); + /* should never get there */ + exit(EXIT_FAILURE); } #if defined(USE_OPENSSL) && !defined(OPENSSL_NO_DH) ssl_free_dh(); #endif - /* should never get there */ - exit(EXIT_FAILURE); + exit(0); /* parent must leave */ } /* child must never use the atexit function */