diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-01-17 16:38:47 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-01-17 16:38:47 -0500 |
commit | dea0720dadea8f3915901833115726f4ba0d48f4 (patch) | |
tree | 95541d12cac8a36180f64e2dbc83c4f3cff38a7f | |
parent | 6e8c2a3e46e3578b0268d422b1753995d18fb734 (diff) | |
download | tor-dea0720dadea8f3915901833115726f4ba0d48f4.tar.gz tor-dea0720dadea8f3915901833115726f4ba0d48f4.zip |
Warn if sizeof(tor_socket_t) != sizeof(SOCKET)
-rw-r--r-- | changes/tor_socket_tests | 3 | ||||
-rw-r--r-- | src/common/compat.c | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changes/tor_socket_tests b/changes/tor_socket_tests index 5857d20886..b7ee3251bb 100644 --- a/changes/tor_socket_tests +++ b/changes/tor_socket_tests @@ -2,6 +2,9 @@ - Find more places in the code that should have been testing for invalid sockets using the SOCKET_OK macro. Required for a fix for bug 4533. Bugfix on 0.2.2.28-beta. + - Detect attempts to build Tor on (as yet hypothetical) versions + of Windows where sizeof(intptr_t) != sizeof(SOCKET). Partial + fix for bug 4533. Bugfix on 0.2.2.28-beta. o Code simplification and refactoring: - Use a TOR_INVALID_SOCKET macro when initializing a socket to an diff --git a/src/common/compat.c b/src/common/compat.c index 7f8903733b..1f9066d20a 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -2889,6 +2889,11 @@ network_init(void) log_warn(LD_NET,"Error initializing windows network layer: code was %d",r); return -1; } + if (sizeof(SOCKET) != sizeof(tor_socket_t)) { + log_warn(LD_BUG,"The tor_socket_t type does not match SOCKET in size; Tor " + "might not work. (Sizes are %d and %d respectively.)", + (int)sizeof(tor_socket_t), (int)sizeof(SOCKET)); + } /* WSAData.iMaxSockets might show the max sockets we're allowed to use. * We might use it to complain if we're trying to be a server but have * too few sockets available. */ |