]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: do not close uninit FD in quic_test_socketops()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 16 Jul 2024 08:51:02 +0000 (10:51 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 16 Jul 2024 08:51:02 +0000 (10:51 +0200)
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.

src/proto_quic.c

index 60aad85db5bfaafe32ef07b2eef35c7865cea986..7456be62943b77b9aec25208c5e39d810e4df9ab 100644 (file)
@@ -577,7 +577,8 @@ static int quic_test_socketopts(struct listener *l)
 #endif
        }
 
-       close(fdtest);
+       if (fdtest >= 0)
+               close(fdtest);
        return ERR_NONE;
 
  err: