mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Merge branch 'bug7935'
This commit is contained in:
commit
dab25eb37d
4
changes/bug7935
Normal file
4
changes/bug7935
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor features (portability):
|
||||||
|
- Work correctly on unix systems where EAGAIN and EWOULDBLOCK are
|
||||||
|
separate error codes--or at least, don't break for that reason.
|
||||||
|
Fixes bug 7935. Reported by "oftc_must_be_destroyed".
|
@ -53,6 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined (WINCE)
|
#if defined (WINCE)
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -538,10 +539,14 @@ int tor_socket_errno(tor_socket_t sock);
|
|||||||
const char *tor_socket_strerror(int e);
|
const char *tor_socket_strerror(int e);
|
||||||
#else
|
#else
|
||||||
#define SOCK_ERRNO(e) e
|
#define SOCK_ERRNO(e) e
|
||||||
|
#if EAGAIN == EWOULDBLOCK
|
||||||
#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN)
|
#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_EINPROGRESS(e) ((e) == EINPROGRESS)
|
||||||
#define ERRNO_IS_CONN_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) \
|
#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \
|
||||||
((e) == EMFILE || (e) == ENFILE || (e) == ENOBUFS || (e) == ENOMEM)
|
((e) == EMFILE || (e) == ENFILE || (e) == ENOBUFS || (e) == ENOMEM)
|
||||||
#define ERRNO_IS_EADDRINUSE(e) ((e) == EADDRINUSE)
|
#define ERRNO_IS_EADDRINUSE(e) ((e) == EADDRINUSE)
|
||||||
|
@ -368,7 +368,11 @@ error_is_eagain(int err)
|
|||||||
#define CLOSE_SOCKET(x) closesocket(x)
|
#define CLOSE_SOCKET(x) closesocket(x)
|
||||||
#else
|
#else
|
||||||
#define last_error(sock) (errno)
|
#define last_error(sock) (errno)
|
||||||
|
#if EAGAIN != EWOULDBLOCK
|
||||||
|
#define error_is_eagain(err) ((err) == EAGAIN || (err) == EWOULDBLOCK)
|
||||||
|
#else
|
||||||
#define error_is_eagain(err) ((err) == EAGAIN)
|
#define error_is_eagain(err) ((err) == EAGAIN)
|
||||||
|
#endif
|
||||||
#define CLOSE_SOCKET(x) close(x)
|
#define CLOSE_SOCKET(x) close(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user