[tor-commits] [tor/master] Really Really Fixup 86eba14ac549: Windows support, error return values

nickm at torproject.org nickm at torproject.org
Wed Nov 18 20:03:47 UTC 2015


commit a1ce111d32a105ce09e17974800e6cc3e239e60f
Author: teor (Tim Wilson-Brown) <teor2345 at gmail.com>
Date:   Thu Nov 19 00:13:58 2015 +1100

    Really Really Fixup 86eba14ac549: Windows support, error return values
---
 src/test/test_util.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 15eb2cf..187cb23 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4342,11 +4342,8 @@ fd_is_nonblocking(tor_socket_t fd)
 }
 #endif
 
-#ifdef EPROTONOSUPPORT
-#define SOCKET_EPROTO(s) (s == -EPROTONOSUPPORT)
-#else
-#define SOCKET_EPROTO(s) (0)
-#endif
+#define ERRNO_IS_EPROTO(e)    (e == SOCK_ERRNO(EPROTONOSUPPORT))
+#define SOCK_ERR_IS_EPROTO(s) ERRNO_IS_EPROTO(tor_socket_errno(s))
 
 /* Test for tor_open_socket*, using IPv4 or IPv6 depending on arg. */
 static void
@@ -4364,7 +4361,7 @@ test_util_socket(void *arg)
   (void)arg;
 
   fd1 = tor_open_socket_with_extensions(domain, SOCK_STREAM, 0, 0, 0);
-  if (SOCKET_EPROTO(fd1)) {
+  if (SOCK_ERR_IS_EPROTO(fd1)) {
     /* Assume we're on an IPv4-only or IPv6-only system, and give up now. */
     goto done;
   }
@@ -4427,7 +4424,7 @@ test_util_socketpair(void *arg)
   int socketpair_result = 0;
 
   socketpair_result = tor_socketpair_fn(family, SOCK_STREAM, 0, fds);
-  if (ersatz && SOCKET_EPROTO(socketpair_result)) {
+  if (ersatz && ERRNO_IS_EPROTO(-socketpair_result)) {
     /* Assume we're on an IPv6-only system, and give up now.
      * (tor_ersatz_socketpair uses IPv4.) */
     goto done;





More information about the tor-commits mailing list