From 47213bf54b9f65d56b3bce89e53959b5c8eb6023 Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Sun, 20 Feb 2011 11:04:45 +0000 Subject: [PATCH] Check for bind() failing. Closes #12299 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/gsocket.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index ebd3b2254b..a2526459e4 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -995,7 +995,12 @@ GSocketError GSocket::Connect(GSocketStream stream) // If a local address has been set, then we need to bind to it before calling connect if (m_local && m_local->m_addr) { - bind(m_fd, m_local->m_addr, m_local->m_len); + if (bind(m_fd, m_local->m_addr, m_local->m_len) < 0) + { + Close(); + m_error = GSOCK_IOERR; + return GSOCK_IOERR; + } } /* Connect it to the peer address, with a timeout (see below) */