]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Warn if sizeof(tor_socket_t) != sizeof(SOCKET)
authorNick Mathewson <nickm@torproject.org>
Tue, 17 Jan 2012 21:38:47 +0000 (16:38 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 17 Jan 2012 21:38:47 +0000 (16:38 -0500)
changes/tor_socket_tests
src/common/compat.c

index 5857d2088672782b1380e9924fe8930918445455..b7ee3251bbd409c7c2abda2920b453bd1b78a48f 100644 (file)
@@ -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
index 7f8903733ba28018a8c679afada1021c9cbcff2f..1f9066d20ae33d2a40d314fd47099236a2d3900f 100644 (file)
@@ -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. */