]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: misplaced exit and wrong exit code
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 7 Jun 2017 13:04:47 +0000 (15:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Jun 2017 18:41:57 +0000 (20:41 +0200)
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.

src/haproxy.c

index 9cbb3d5cf64d0c0455a995b58f1f5d2926f2da0a..d64058dab51f6d58f3b1ff00b69dd1d2a30b4525 100644 (file)
@@ -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 */