From: brain Date: Sat, 11 Mar 2006 17:27:20 +0000 (+0000) Subject: Re-enterance safety X-Git-Tag: v2.0.23~8431 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=db20c20a945e2107e1a9c66d62127c0833075ea8;p=user%2Fhenk%2Fcode%2Finspircd.git Re-enterance safety git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3665 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/socket.cpp b/src/socket.cpp index d4cdb0a18..f4e6a5a6a 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -147,6 +147,7 @@ bool InspSocket::DoResolve() this->Close(); this->state = I_ERROR; this->OnError(I_ERR_RESOLVE); + this->fd = -1; return false; } return this->DoConnect(); @@ -163,6 +164,7 @@ bool InspSocket::DoConnect() log(DEBUG,"Cant socket()"); this->state = I_ERROR; this->OnError(I_ERR_SOCKET); + this->fd = -1; return false; } @@ -184,6 +186,7 @@ bool InspSocket::DoConnect() this->OnError(I_ERR_CONNECT); this->state = I_ERROR; this->Close(); + this->fd = -1; return false; } } @@ -275,6 +278,7 @@ bool InspSocket::FlushWriteBuffer() log(DEBUG,"Write error on socket: %s",strerror(errno)); this->OnError(I_ERR_WRITE); this->state = I_ERROR; + this->fd = -1; return true; } } @@ -295,6 +299,7 @@ bool InspSocket::Timeout(time_t current) this->OnError(I_ERR_TIMEOUT); timeout = true; this->state = I_ERROR; + this->fd = -1; return true; } return this->FlushWriteBuffer(); @@ -305,6 +310,9 @@ bool InspSocket::Poll() int incoming = -1; bool n = true; + if ((fd < 0) || (fd > MAX_DESCRIPTORS)) + return false; + switch (this->state) { case I_RESOLVING: diff --git a/src/svn-rev.sh b/src/svn-rev.sh index 846663619..5e819f84a 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3661 +echo 3664