Mesa (master): gallium/util: don't depend on implementation defined behavior in listen()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 18 10:12:35 UTC 2019


Module: Mesa
Branch: master
Commit: f6461df63a9e3e5f215a03a8fb8f2d4d41152007
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6461df63a9e3e5f215a03a8fb8f2d4d41152007

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Mon Sep 16 14:43:13 2019 +0200

gallium/util: don't depend on implementation defined behavior in listen()

Using 0 as the backlog argument to listen() is exploiting implementation
defined behavior and will lead to no connections being accepted on some
libc implementations.

Quote of the listen manpage: "A backlog argument of 0 may allow the socket to
accept connections, in which case the length of the listen queue may be set to
an implementation-defined minimum value."

Fix this by using a more sensible backlog value.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>

---

 src/gallium/auxiliary/util/u_network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c
index a87ddab0bde..31139f2983f 100644
--- a/src/gallium/auxiliary/util/u_network.c
+++ b/src/gallium/auxiliary/util/u_network.c
@@ -167,7 +167,7 @@ u_socket_listen_on_port(uint16_t portnum)
       return -1;
    }
 
-   listen(s, 0);
+   listen(s, 1);
 
    return s;
 #else




More information about the mesa-commit mailing list