diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-08-06 16:41:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-08-06 16:41:53 -0400 |
commit | 031e695aa50f24000ec112d535636807167be436 (patch) | |
tree | 0d8bc274207983cdc7ab718edc94b5d0ef3486c4 /src/common | |
parent | 0a0f93d277046a524740ad110060abf8ed137b8f (diff) | |
download | tor-031e695aa50f24000ec112d535636807167be436.tar.gz tor-031e695aa50f24000ec112d535636807167be436.zip |
Use SOCKET_OK/TOR_INVALID_SOCKET in socketpair replacement code
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/compat.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 69eb0643d0..bf6a0a4243 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1225,9 +1225,9 @@ tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2]) * for now, and really, when localhost is down sometimes, we * have other problems too. */ - tor_socket_t listener = -1; - tor_socket_t connector = -1; - tor_socket_t acceptor = -1; + tor_socket_t listener = TOR_INVALID_SOCKET; + tor_socket_t connector = TOR_INVALID_SOCKET; + tor_socket_t acceptor = TOR_INVALID_SOCKET; struct sockaddr_in listen_addr; struct sockaddr_in connect_addr; int size; @@ -1306,11 +1306,11 @@ tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2]) tidy_up_and_fail: if (saved_errno < 0) saved_errno = errno; - if (listener != -1) + if (SOCKET_OK(listener)) tor_close_socket(listener); - if (connector != -1) + if (SOCKET_OK(connector)) tor_close_socket(connector); - if (acceptor != -1) + if (SOCKET_OK(acceptor)) tor_close_socket(acceptor); return -saved_errno; #endif |