-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Closed
Description
Describe the bug
In src/anet.c, line 503, _anetTcpServer will call anetV6Only. If it failed in setsockopt at line 471, it will close the socket and goto label error at line 513 without change socket to -1. Suppose that we do not support IPV6 Protocol, and we create a socket, then it will be closed. And at the "error" label, it will be closed twice and return a errno EBADF, which will cause failure to create any tcp server.
To reproduce
- Use lwip (https://git.savannah.nongnu.org/cgit/lwip.git, version 2.1.2 released) as the Internet support.
- Set LWIP_IPV6 macro to 0
- Compile the redis and run redis-server
- We can observe that redis cannot create any http server.
Expected behavior
The socket should be set to -1 to avoid double close.
Additional information
It can simply resolved by adding "s = -1" in the conditional branch at line 504.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels