diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-30 20:32:59 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-30 20:32:59 +0000 |
commit | 706303e177d05afa6269d3a40cfde726854c52c3 (patch) | |
tree | 2ec930b1d7593c0e6a8da60d83ab39ab129ae515 /src/inspsocket.cpp | |
parent | b5c983ca55f9a46863904db0afd8f6add63d1a45 (diff) |
Whoops, fix inspsocket so that its ok to use errno after a failure of the Write/Read methods or constructor!
the close() in its Close method always changed errno to "Endpoint is not connected" on error, so now we make a copy.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6462 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-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() |