diff --git a/hphp/runtime/ext/vsdebug/socket_transport.cpp b/hphp/runtime/ext/vsdebug/socket_transport.cpp index e0c575a3e88bdf..d936fb14bf0b79 100644 --- a/hphp/runtime/ext/vsdebug/socket_transport.cpp +++ b/hphp/runtime/ext/vsdebug/socket_transport.cpp @@ -21,6 +21,8 @@ #include "hphp/util/configs/debugger.h" #include "hphp/util/user-info.h" +#include + #include #include #include @@ -160,9 +162,7 @@ void SocketTransport::listenForClientConnection() { freeaddrinfo(ai); } - for (auto it = socketFds.begin(); it != socketFds.end(); it++) { - close(*it); - } + std::for_each(socketFds.begin(), socketFds.end(), close); close(abortFd); m_abortPipeFd[0] = -1; @@ -575,10 +575,6 @@ void SocketTransport::waitForConnection( if (fds != nullptr) { free(fds); } - - for (const int fd : socketFds) { - close(fd); - } }; // fds[0] will contain the read end of our "abort" pipe. Another thread will