diff options
-rw-r--r-- | src/inspsocket.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 18fd346b7..f408de6dd 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -235,6 +235,11 @@ bool InspSocket::DoConnect() void InspSocket::Close() { + /* Save this, so we dont lose it, + * otherise on failure, error messages + * might be inaccurate. + */ + int save = errno; if (this->fd > -1) { if (this->IsIOHooked && Instance->Config->GetIOHook(this)) @@ -252,6 +257,7 @@ void InspSocket::Close() shutdown(this->fd,2); close(this->fd); } + errno = save; } std::string InspSocket::GetIP() |