X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c4a5c57dc3ad079ca7017f1881613937a602e72e..07a874fd9b990c4ea1e370d350fc77f9ecc171b5:/socket.c diff --git a/socket.c b/socket.c index 843c19b6..15dea8b8 100644 --- a/socket.c +++ b/socket.c @@ -122,12 +122,14 @@ int try_bind_local(int s, for (r = bres_all; r; r = r->ai_next) { if (bind(s, r->ai_addr, r->ai_addrlen) == -1) continue; + freeaddrinfo(bres_all); return s; } /* no error message; there might be some problem that allows * creation of the socket but not binding, perhaps if the * machine has no ipv6 address of this name. */ + freeaddrinfo(bres_all); return -1; } @@ -182,6 +184,10 @@ int open_socket_out(char *host, int port, const char *bind_address, *cp++ = '\0'; strcpy(portbuf, cp); h = buffer; + if (verbose >= 2) { + rprintf(FINFO, "connection via http proxy %s port %s\n", + h, portbuf); + } } else { snprintf(portbuf, sizeof(portbuf), "%d", port); h = host; @@ -325,7 +331,8 @@ static int open_socket_in(int type, int port, const char *bind_address, close(s); continue; } - + + freeaddrinfo(all_ai); return s; } @@ -435,9 +442,10 @@ void start_accept_loop(int port, int (*fn)(int )) * overloaded. Sleep briefly before trying to * accept again. */ sleep(2); + } else { + /* Parent doesn't need this fd anymore. */ + close(fd); } - - close(fd); } }