mirror of
https://github.com/samba-team/samba.git
synced 2025-12-03 04:23:50 +03:00
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 commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user