]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: init: 'devnullfd' not properly closed for master
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 12 Nov 2025 14:58:33 +0000 (15:58 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 12 Nov 2025 15:06:28 +0000 (16:06 +0100)
Since commit "1ec59d3 MINOR: init: Make devnullfd global and create it
earlier in init" the devnullfd pointing towards /dev/null gets created
early in the init process but it was closed after the call to
"mworker_run_master". The master process never got to the FD closing
code and we had an FD leak.

This patch does not need to be backported.

src/mworker.c

index fea5920082f1ff8d482bf69935dd6f45a17e1326..ab0e0547d68288ddbfbc338f9a31d631c38f2e6f 100644 (file)
@@ -1151,6 +1151,9 @@ void mworker_run_master(void)
 {
        struct mworker_proc *child, *it;
 
+       close(devnullfd);
+       devnullfd = -1;
+
        proc_self->failedreloads = 0; /* reset the number of failure */
        mworker_loop();
 #if defined(USE_OPENSSL) && !defined(OPENSSL_NO_DH)