mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Make the return value of tor_addr_sockaddr always be signed
This commit is contained in:
@@ -53,9 +53,7 @@
|
||||
* socklen object in *<b>sa_out</b> of object size <b>len</b>. If not enough
|
||||
* room is free, or on error, return -1. Else return the length of the
|
||||
* sockaddr. */
|
||||
/* XXXX021 This returns socklen_t. socklen_t is sometimes unsigned. This
|
||||
* function claims to return -1 sometimes. Problematic! */
|
||||
socklen_t
|
||||
int
|
||||
tor_addr_to_sockaddr(const tor_addr_t *a,
|
||||
uint16_t port,
|
||||
struct sockaddr *sa_out,
|
||||
|
||||
@@ -39,7 +39,7 @@ static INLINE sa_family_t tor_addr_family(const tor_addr_t *a);
|
||||
static INLINE const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
|
||||
static INLINE int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
|
||||
|
||||
socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
|
||||
int tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
|
||||
struct sockaddr *sa_out, socklen_t len);
|
||||
int tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa,
|
||||
uint16_t *port_out);
|
||||
|
||||
+2
-2
@@ -1281,7 +1281,7 @@ connection_connect(connection_t *conn, const char *address,
|
||||
int s, inprogress = 0;
|
||||
char addrbuf[256];
|
||||
struct sockaddr *dest_addr = (struct sockaddr*) addrbuf;
|
||||
socklen_t dest_addr_len;
|
||||
int dest_addr_len;
|
||||
or_options_t *options = get_options();
|
||||
int protocol_family;
|
||||
|
||||
@@ -1337,7 +1337,7 @@ connection_connect(connection_t *conn, const char *address,
|
||||
log_debug(LD_NET, "Connecting to %s:%u.",
|
||||
escaped_safe_str_client(address), port);
|
||||
|
||||
if (connect(s, dest_addr, dest_addr_len) < 0) {
|
||||
if (connect(s, dest_addr, (socklen_t)dest_addr_len) < 0) {
|
||||
int e = tor_socket_errno(s);
|
||||
if (!ERRNO_IS_CONN_EINPROGRESS(e)) {
|
||||
/* yuck. kill it. */
|
||||
|
||||
Reference in New Issue
Block a user