]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: don't fill the -sf argument with -1 during the reexec
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 19 Nov 2019 16:04:18 +0000 (17:04 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 19 Nov 2019 16:30:34 +0000 (17:30 +0100)
Upon a reexec_on_failure, if the process tried to exit after the
initialization of the process structure but before it was filled with a
PID, the PID in the mworker_proc structure is set to -1.

In this particular case the -sf argument is filled with -1 and haproxy
will exit with the usage message because of that argument.

Should be backported in 2.0.

src/haproxy.c

index 84a3384b109683797e298bd28299326a584ef37a..699a1fea0e3f56f4b275e53a433a5853c192cc9b 100644 (file)
@@ -787,7 +787,7 @@ void mworker_reload()
                next_argv[next_argc++] = "-sf";
 
                list_for_each_entry(child, &proc_list, list) {
-                       if (!(child->options & (PROC_O_TYPE_WORKER|PROC_O_TYPE_PROG)))
+                       if (!(child->options & (PROC_O_TYPE_WORKER|PROC_O_TYPE_PROG)) || child->pid <= -1 )
                                continue;
                        next_argv[next_argc] = memprintf(&msg, "%d", child->pid);
                        if (next_argv[next_argc] == NULL)