]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: startup: call chroot() if needed in one place
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 4 Jul 2024 13:51:12 +0000 (15:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commit02af1fe067f73cece99cf92386b3551b3932b665
treebebbbd828fb29bb3aa1fd89106ba09d266240add
parent7a2ee10d71533e34a110e1f6fbb51db3367b2aa2
MEDIUM: startup: call chroot() if needed in one place

There are two 'chroot' code blocks, both under quite same:

'if ((global.mode & (MODE_MWORKER|MODE_DAEMON...)...'

The first block serves to perform chroot only for process in the foreground
mode. The second comes after master-worker fork and allows to do chroot
in daemon and in worker modes.

Due to moving the master-worker fork in init() in some previous commit, the
second 'chroot' code block now is no longer under the 'if'. So, it is executed
for all modes, except MODE_MWORKER. Now in MODE_MWORKER process enters in its
wait polling loop just after forking a worker and it terminates almost
immediately, if it exits this loop.

Worker, daemon and process in a foreground mode will perform the chroot as
before, but now it will be done in a one place at main().
src/haproxy.c