From: Amir Shalem Date: Sun, 4 Dec 2016 19:15:34 +0000 (-0800) Subject: Fix potential double close() on exception X-Git-Tag: v2016.12.05.00^0 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fae84c77f3cd88d9e7ccfc39a1fa04ad80f7f540;p=folly.git 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 --- diff --git a/folly/io/async/AsyncUDPSocket.cpp b/folly/io/async/AsyncUDPSocket.cpp index 0cf9d8cf..082f7994 100644 --- a/folly/io/async/AsyncUDPSocket.cpp +++ b/folly/io/async/AsyncUDPSocket.cpp @@ -88,7 +88,6 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) { SO_REUSEPORT, &value, sizeof(value)) != 0) { - ::close(socket); throw AsyncSocketException(AsyncSocketException::NOT_OPEN, "failed to put socket in reuse_port mode", errno);