fix for socket poll() crash when (fd == -1)

This commit is contained in:
Marian Krivos 2009-03-12 12:47:00 +00:00
parent 3878959ac0
commit 5f35304974

View File

@ -329,6 +329,8 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, in
void SocketImpl::sendUrgent(unsigned char data) void SocketImpl::sendUrgent(unsigned char data)
{ {
poco_assert (_sockfd != POCO_INVALID_SOCKET);
int rc = ::send(_sockfd, reinterpret_cast<const char*>(&data), sizeof(data), MSG_OOB); int rc = ::send(_sockfd, reinterpret_cast<const char*>(&data), sizeof(data), MSG_OOB);
if (rc < 0) error(); if (rc < 0) error();
} }
@ -344,6 +346,8 @@ int SocketImpl::available()
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
{ {
poco_assert (_sockfd != POCO_INVALID_SOCKET);
#if defined(POCO_HAVE_FD_POLL) #if defined(POCO_HAVE_FD_POLL)
pollfd pollBuf; pollfd pollBuf;