]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker: do not export HAPROXY_MWORKER_REEXEC across programs
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Jul 2021 08:17:02 +0000 (10:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Jul 2021 08:17:02 +0000 (10:17 +0200)
This undocumented variable is only for internal use, and its sole
presence affects the process' behavior, as shown in bug #1324. It must
not be exported to workers, external checks, nor programs. Let's unset
it before forking programs and workers.

This should be backported as far as 1.8. The worker code might differ
a bit before 2.5 due to the recent removal of multi-process support.

src/haproxy.c
src/mworker-prog.c

index fd5ef30615f19b14b826dd128644514b7034f214..5d3d92869489e199db15805c74553d97e6c4c202 100644 (file)
@@ -3183,6 +3183,8 @@ int main(int argc, char **argv)
                                exit(1); /* there has been an error */
                        }
                        else if (ret == 0) { /* child breaks here */
+                               /* This one must not be exported, it's internal! */
+                               unsetenv("HAPROXY_MWORKER_REEXEC");
                                ha_random_jump96(1);
                        }
                        else { /* parent here */
index 4a646621398a6393d0108207d2a67e1f780c31db..9de94a2894a7e27bd11702dcfbec43a73997b548 100644 (file)
@@ -110,6 +110,8 @@ int mworker_ext_launch_all()
                                        exit(1);
                                }
 
+                               /* This one must not be exported, it's internal! */
+                               unsetenv("HAPROXY_MWORKER_REEXEC");
                                execvp(child->command[0], child->command);
 
                                ha_alert("Cannot execute %s: %s\n", child->command[0], strerror(errno));