[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Really Really Fixup 86eba14ac549: Windows support, error return values
commit a1ce111d32a105ce09e17974800e6cc3e239e60f
Author: teor (Tim Wilson-Brown) <teor2345@xxxxxxxxx>
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;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits