summaryrefslogtreecommitdiff
path: root/socket.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-01-02 17:47:44 +0000
committerWayne Davison <wayned@samba.org>2004-01-02 17:47:44 +0000
commite028b9ff53d31dc97a8d491f5551aff02a3850b6 (patch)
tree17a61bdad6a26ed8b3b1f0b1f26426475cb64dba /socket.c
parent9c07d253451b9bcd898811fa46a76676b89dc014 (diff)
downloadrsync-e028b9ff53d31dc97a8d491f5551aff02a3850b6.tar.gz
rsync-e028b9ff53d31dc97a8d491f5551aff02a3850b6.tar.bz2
rsync-e028b9ff53d31dc97a8d491f5551aff02a3850b6.zip
Call bind() with the right ai_addr/ai_addrlen info.
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/socket.c b/socket.c
index 239c2995..72983517 100644
--- a/socket.c
+++ b/socket.c
@@ -80,8 +80,7 @@ static int establish_proxy_connection(int fd, char *host, int port)
}
/* throw away the rest of the HTTP header */
while (1) {
- for (cp = buffer; cp < &buffer[sizeof (buffer) - 1];
- cp++) {
+ for (cp = buffer; cp < &buffer[sizeof (buffer) - 1]; cp++) {
if (read(fd, cp, 1) != 1) {
rprintf(FERROR, "failed to read from proxy: %s\n",
strerror(errno));
@@ -103,8 +102,7 @@ static int establish_proxy_connection(int fd, char *host, int port)
* Try to set the local address for a newly-created socket. Return -1
* if this fails.
**/
-int try_bind_local(int s,
- int ai_family, int ai_socktype,
+int try_bind_local(int s, int ai_family, int ai_socktype,
const char *bind_address)
{
int error;
@@ -322,8 +320,8 @@ static int open_socket_in(int type, int port, const char *bind_address,
setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
(char *)&one, sizeof one);
- /* now we've got a socket - we need to bind it */
- if (bind(s, all_ai->ai_addr, all_ai->ai_addrlen) < 0) {
+ /* Now we've got a socket - we need to bind it. */
+ if (bind(s, resp->ai_addr, resp->ai_addrlen) < 0) {
/* Nope, try another */
close(s);
continue;