瀏覽代碼

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@pengutronix.de>
tags/19.3-branchpoint
Lucas Stach 6 年之前
父節點
當前提交
f6461df63a
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      src/gallium/auxiliary/util/u_network.c

+ 1
- 1
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

Loading…
取消
儲存