summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-02-03 12:25:46 +0000
committerRoger Dingledine <arma@torproject.org>2006-02-03 12:25:46 +0000
commit6f579deff4d18922a8809960cad3838f634c3ee9 (patch)
tree1de46c8799fd1e71416d2d6e3f8374086cca069c /src/common
parent1800fbe4862e5e810487bf27b0c8ef18c8ee4433 (diff)
downloadtor-6f579deff4d18922a8809960cad3838f634c3ee9.tar.gz
tor-6f579deff4d18922a8809960cad3838f634c3ee9.zip
check for EADDRINUSE in a cross-platform way (unless i'm wrong)
svn:r5899
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index be86a87e2a..0f13134f6d 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -189,6 +189,8 @@ int network_init(void);
* accept() has failed because we're out of fds or something. */
#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \
((e) == WSAEMFILE || (e) == WSAENOBUFS)
+/** Return true if e is EADDRINUSE or the local equivalent. */
+#define ERRNO_IS_EADDRINUSE(e) ((e) == WSAEADDRINUSE)
int tor_socket_errno(int sock);
const char *tor_socket_strerror(int e);
#else
@@ -198,6 +200,7 @@ const char *tor_socket_strerror(int e);
#define ERRNO_IS_ACCEPT_EAGAIN(e) ((e) == EAGAIN || (e) == ECONNABORTED)
#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \
((e) == EMFILE || (e) == ENFILE || (e) == ENOBUFS || (e) == ENOMEM)
+#define ERRNO_IS_EADDRINUSE(e) ((e) == EADDRINUSE)
#define tor_socket_errno(sock) (errno)
#define tor_socket_strerror(e) strerror(e)
#endif