mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-08 06:35:12 +00:00
enable SOCK_CLOEXEC explicit
leaking here means fork/vfork will duplicate fd without O_CLOEXEC flag to the child process. Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
parent
3f0c9306d3
commit
eab2cba4a1
20 changed files with 56 additions and 30 deletions
|
|
@ -92,7 +92,8 @@ void netlib_server(uint16_t portno,
|
|||
/* Accept the next connection */
|
||||
|
||||
addrlen = sizeof(struct sockaddr_in);
|
||||
acceptsd = accept(listensd, (struct sockaddr *)&myaddr, &addrlen);
|
||||
acceptsd = accept4(listensd, (struct sockaddr *)&myaddr, &addrlen,
|
||||
SOCK_CLOEXEC);
|
||||
if (acceptsd < 0)
|
||||
{
|
||||
nerr("ERROR: accept failure: %d\n", errno);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue