summaryrefslogtreecommitdiff
path: root/util-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-01-11 16:37:34 -0800
committerNick Mathewson <nickm@torproject.org>2013-01-11 16:37:34 -0800
commitbf7a0ff26808199ec68b86bb78c65fc21ba770f9 (patch)
treec518eadaed2138552adecbe3d54b60c391cb0492 /util-internal.h
parentb452a4345088dcc7e7491bcff612f9f11dfb17da (diff)
downloadlibevent-bf7a0ff26808199ec68b86bb78c65fc21ba770f9.tar.gz
When EWOULDBLOCK is not EAGAIN, treat it as equivalent to it
Acording to http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values there are some older unixes that distinguish these error.s
Diffstat (limited to 'util-internal.h')
-rw-r--r--util-internal.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/util-internal.h b/util-internal.h
index fa29f271..f52ae3f4 100644
--- a/util-internal.h
+++ b/util-internal.h
@@ -79,15 +79,23 @@ extern "C" {
#ifndef _WIN32
+#if EAGAIN == EWOULDBLOCK
+#define EVUTIL_ERR_IS_EAGAIN(e) \
+ ((e) == EAGAIN)
+#else
+#define EVUTIL_ERR_IS_EAGAIN(e) \
+ ((e) == EAGAIN || (e) == EWOULDBLOCK)
+#endif
+
/* True iff e is an error that means a read/write operation can be retried. */
#define EVUTIL_ERR_RW_RETRIABLE(e) \
- ((e) == EINTR || (e) == EAGAIN)
+ ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e))
/* True iff e is an error that means an connect can be retried. */
#define EVUTIL_ERR_CONNECT_RETRIABLE(e) \
((e) == EINTR || (e) == EINPROGRESS)
/* True iff e is an error that means a accept can be retried. */
#define EVUTIL_ERR_ACCEPT_RETRIABLE(e) \
- ((e) == EINTR || (e) == EAGAIN || (e) == ECONNABORTED)
+ ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e) || (e) == ECONNABORTED)
/* True iff e is an error that means the connection was refused */
#define EVUTIL_ERR_CONNECT_REFUSED(e) \