diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-09-29 09:42:36 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-09-29 09:43:16 +0200 |
commit | 7ebce759122eeda383d7d299ee577c75c0f9ac6e (patch) | |
tree | 330b0cbb1b66d84c98740d3f59918f8cbf42c436 | |
parent | 467df2ad33dee4f5640c1451d2db645c19641a71 (diff) | |
download | tigervnc-7ebce759122eeda383d7d299ee577c75c0f9ac6e.tar.gz tigervnc-7ebce759122eeda383d7d299ee577c75c0f9ac6e.zip |
Return correct error code from bind()
Closing the socket might overwrite errno so we need to save
its value.
-rw-r--r-- | common/network/TcpSocket.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index 9ac1478c..a25ee244 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -469,8 +469,9 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, #endif if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { + int e = errorNumber; closesocket(sock); - throw SocketException("failed to bind socket", errorNumber); + throw SocketException("failed to bind socket", e); } // - Set it to be a listening socket |