diff options
author | James Peach <jpeach@samba.org> | 2007-12-09 13:28:00 -0800 |
---|---|---|
committer | James Peach <jpeach@samba.org> | 2007-12-09 13:28:00 -0800 |
commit | daba3f8b54b04fe8623db3bab90c3aba15d4c379 (patch) | |
tree | 4730b9a87d7fa87b6f7b677c2053dd5dc72e8ee8 /source3/lib/sock_exec.c | |
parent | 2ecdbea0cb8089e09bf6e2ba4c12da09b15036a4 (diff) | |
download | samba-daba3f8b54b04fe8623db3bab90c3aba15d4c379.tar.gz samba-daba3f8b54b04fe8623db3bab90c3aba15d4c379.tar.bz2 samba-daba3f8b54b04fe8623db3bab90c3aba15d4c379.zip |
Fix connect(2) callers to use correct sockaddr size.
Some systems (eg Mac OSX 10.5) require the length passed to match
the socket address family. This introduces sys_connect() that does
the right thing, and replaces all uses oc connect(2) with sys_connect().
Note that there are some LGPL callers that still call connect(2)
directly.
(This used to be commit e1bfdc17c49da582cdf907e260301ab1946b2ed3)
Diffstat (limited to 'source3/lib/sock_exec.c')
-rw-r--r-- | source3/lib/sock_exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/lib/sock_exec.c b/source3/lib/sock_exec.c index 5e3178cba9..203d7e93b3 100644 --- a/source3/lib/sock_exec.c +++ b/source3/lib/sock_exec.c @@ -60,7 +60,7 @@ static int socketpair_tcp(int fd[2]) sock.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if (connect(fd[1],(struct sockaddr *)&sock,sizeof(sock)) == -1) { + if (sys_connect(fd[1], (struct sockaddr *)&sock) == -1) { if (errno != EINPROGRESS) goto failed; } else { connect_done = 1; @@ -70,7 +70,7 @@ static int socketpair_tcp(int fd[2]) close(listener); if (connect_done == 0) { - if (connect(fd[1],(struct sockaddr *)&sock,sizeof(sock)) != 0 + if (sys_connect(fd[1], (struct sockaddr *)&sock) != 0 && errno != EISCONN) goto failed; } |