> Le 7 juin 2017 à 10:34, Emmanuel Hocdet <[email protected]> a écrit :
> 
> Hi,
> 
> ok:
>> haproxy -f test.cfg -W
>> echo $?
> 0
> 
> bad:
>> haproxy -f test.cfg
>> echo $?
> 1
> 
> With bunch of modified code, i am a little lost to track the bug.
> 
> Manu
> 
> 


This patch seem correct the problem, but…

diff --git a/src/haproxy.c b/src/haproxy.c
index 60bd334..1cc39b0 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2495,9 +2495,9 @@ int main(int argc, char **argv)
                 * process live in background before forking children
                 */
 
-               if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL)
-                   && (global.mode & MODE_MWORKER)
-                   && (global.mode & MODE_DAEMON)) {
+               if (((getenv("HAPROXY_MWORKER_REEXEC") == NULL)
+                    && (global.mode & MODE_MWORKER)  && (global.mode & 
MODE_DAEMON))
+                   || (!(global.mode & MODE_MWORKER) && (global.mode & 
MODE_DAEMON))) {
                        ret = fork();
                        if (ret < 0) {
                                Alert("[%s.main()] Cannot fork.\n", argv[0]);

Reply via email to