From: Amaury Denoyelle Date: Tue, 16 Jul 2024 08:51:02 +0000 (+0200) Subject: BUG/MINOR: do not close uninit FD in quic_test_socketops() X-Git-Tag: v3.1-dev4~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d57b95aab7afc771c9e3dd0def0821baeddce6f2;p=thirdparty%2Fhaproxy.git BUG/MINOR: do not close uninit FD in quic_test_socketops() On startup, quic_test_socketops() is called to ensure that chosen configuration option are compatible with UDP system stack. A dummy FD is allocated to invoke various setsockopt() settings. If no tests are required, FD is not allocated. In this case, close() should not be close. This is mostly for better coding as this does not cause any real issue for users. This should fix github issue #2638. No need to backport. --- diff --git a/src/proto_quic.c b/src/proto_quic.c index 60aad85db5..7456be6294 100644 --- a/src/proto_quic.c +++ b/src/proto_quic.c @@ -577,7 +577,8 @@ static int quic_test_socketopts(struct listener *l) #endif } - close(fdtest); + if (fdtest >= 0) + close(fdtest); return ERR_NONE; err: