Commit fae84c77 authored by Amir Shalem's avatar Amir Shalem Committed by Facebook Github Bot

Fix potential double close() on exception

Summary:
Fix potential double close() on exception when SO_REUSEPORT fails.
The fd will be closed twice, once by close() and second by the scope guard above.

Reviewed By: yfeldblum

Differential Revision: D4272300

fbshipit-source-id: a163be822d7522cadb9dc3c3eddca10df453de14
parent 42c52025
...@@ -88,7 +88,6 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) { ...@@ -88,7 +88,6 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) {
SO_REUSEPORT, SO_REUSEPORT,
&value, &value,
sizeof(value)) != 0) { sizeof(value)) != 0) {
::close(socket);
throw AsyncSocketException(AsyncSocketException::NOT_OPEN, throw AsyncSocketException(AsyncSocketException::NOT_OPEN,
"failed to put socket in reuse_port mode", "failed to put socket in reuse_port mode",
errno); errno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment