aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-12-17 21:04:36 +0000
committerVincent Richard <[email protected]>2013-12-17 21:04:36 +0000
commit73eded2f978e678daeee680e83a9aa3767f8d977 (patch)
treebdc63a041b0c7585ea8dca1d11715b11b2f6c294
parentIMAP parsing workarounds for Yandex. (diff)
downloadvmime-73eded2f978e678daeee680e83a9aa3767f8d977.tar.gz
vmime-73eded2f978e678daeee680e83a9aa3767f8d977.zip
More robust error checking.
-rw-r--r--src/platforms/posix/posixSocket.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
index eb00beb6..e245bd95 100644
--- a/src/platforms/posix/posixSocket.cpp
+++ b/src/platforms/posix/posixSocket.cpp
@@ -46,9 +46,9 @@
#if defined(EWOULDBLOCK)
-# define IS_EAGAIN(x) ((x) == EAGAIN || (x) == EWOULDBLOCK || (x) == EINTR)
+# define IS_EAGAIN(x) ((x) == EAGAIN || (x) == EWOULDBLOCK || (x) == EINTR || (x) == EINPROGRESS)
#else
-# define IS_EAGAIN(x) ((x) == EAGAIN || (x) == EINTR)
+# define IS_EAGAIN(x) ((x) == EAGAIN || (x) == EINTR || (x) == EINPROGRESS)
#endif
@@ -551,9 +551,9 @@ void posixSocket::sendRaw(const byte_t* buffer, const size_t count)
{
const ssize_t ret = ::send(m_desc, buffer, size, 0);
- if (ret < 0)
+ if (ret <= 0)
{
- if (!IS_EAGAIN(errno))
+ if (ret < 0 && !IS_EAGAIN(errno))
throwSocketError(errno);
platform::getHandler()->wait();
@@ -577,9 +577,9 @@ size_t posixSocket::sendRawNonBlocking(const byte_t* buffer, const size_t count)
const ssize_t ret = ::send(m_desc, buffer, count, 0);
- if (ret < 0)
+ if (ret <= 0)
{
- if (!IS_EAGAIN(errno))
+ if (ret < 0 && !IS_EAGAIN(errno))
throwSocketError(errno);
m_status |= STATUS_WOULDBLOCK;