diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-01-11 16:27:45 -0800 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-11 16:36:54 -0800 |
commit | a5ee3834bf060c8a238be84ea7287bdfa8303a27 (patch) | |
tree | e8785e1ce22eed6e376e0e8bcc400bf7f0f02516 /src/common/compat.h | |
parent | dffc8e359bcfeb00813a3afde6aa2328f6a6a476 (diff) | |
download | tor-a5ee3834bf060c8a238be84ea7287bdfa8303a27.tar.gz tor-a5ee3834bf060c8a238be84ea7287bdfa8303a27.zip |
Handle EWOULDBLOCK as EAGAIN if they happen to be different.
Fixes bug 7935. Reported by 'oftc_must_be_destroyed'.
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 9c544fa309..f597c122c2 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -53,6 +53,7 @@ #endif #include <stdio.h> +#include <errno.h> #if defined (WINCE) #include <fcntl.h> @@ -538,10 +539,14 @@ int tor_socket_errno(tor_socket_t sock); const char *tor_socket_strerror(int e); #else #define SOCK_ERRNO(e) e +#if EAGAIN == EWOULDBLOCK #define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN) +#else +#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || (e) == EWOULDBLOCK) +#endif #define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS) #define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS) -#define ERRNO_IS_ACCEPT_EAGAIN(e) ((e) == EAGAIN || (e) == ECONNABORTED) +#define ERRNO_IS_ACCEPT_EAGAIN(e) (ERRNO_IS_EAGAIN(e) || (e) == ECONNABORTED) #define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \ ((e) == EMFILE || (e) == ENFILE || (e) == ENOBUFS || (e) == ENOMEM) #define ERRNO_IS_EADDRINUSE(e) ((e) == EADDRINUSE) |