]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: add helpers to backup/clean/restore env
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 21 Aug 2024 17:06:33 +0000 (19:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Aug 2024 15:06:33 +0000 (17:06 +0200)
commit1811d2a6ba78181c51085f01f5138b735446c2e5
tree2795e970802230381e403bb41574643589f69b89
parent960d68a5af6c89da1333ac9e1f118496ad358082
MINOR: tools: add helpers to backup/clean/restore env

'setenv', 'presetenv', 'unsetenv', 'resetenv' keywords in configuration could
modify the process runtime environment. In case of master-worker mode this
creates a problem, as the configuration is read only once before the forking a
worker and then the master process does the reexec without reading any config
files, just to free the memory. So, during the reload a new worker process will
be created, but it will inherited the previous unchanged environment from the
master in wait mode, thus it won't benefit the changes in configuration,
related to '*env' keywords. This may cause unexpected behavior or some parser
errors in master-worker mode.

So, let's add a helper to backup all process env variables just before it will
read its configuration. And let's also add helpers to clean up the current
runtime environment and to restore it to its initial state (as it was before
parsing the config).
include/haproxy/tools.h
src/tools.c