]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: startup: close pidfd and free global.pidfile in handle_pidfile()
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 2 Dec 2024 15:04:56 +0000 (16:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 2 Dec 2024 16:28:04 +0000 (17:28 +0100)
commita33977da48978299d2d71403593846b1b21ec768
treec08b956283f7d4b85185dd673f12d6addd1f5a71
parentd3c20b02469dea6f46369bb91965d8b4924bb2b7
BUG/MINOR: startup: close pidfd and free global.pidfile in handle_pidfile()

After master-worker mode refactoring, global.pidfile is only used in
handle_pidfile(), which opens the provided file and writes the PID into it. So,
it's more appropriate to perform the close(pidfd) and ha_free(&global.pidfile)
also in this function.

This commit prepares the fix of the pidfile creation, as it's created now very
early, when we are not sure, that process has successfully started. In
master-worker mode handle_pidfile() can be called in the master process context.
So, let's make it accessible from other compilation units via global.h.

This should be backported only in 3.1.
include/haproxy/global.h
src/haproxy.c