1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

socket_wrapper: Make it work on freebsd for udp packets

Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Oct 10 12:57:00 UTC 2010 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2010-10-10 12:29:08 +02:00 committed by Matthieu Patou
parent 9d958ce582
commit 9b9489479e

View File

@ -1967,7 +1967,17 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
si->defer_connect = 0;
}
ret = real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
/* Man page for Linux says:
* "the error EISONN may be returned when they are not NULL and 0"
* But in practice it's not on x86/amd64, but on other unix it is
* (ie. freebsd)
* So if we are already connected we send NULL/0
*/
if (si->connected) {
ret = real_sendto(s, buf, len, flags, NULL, 0);
} else {
ret = real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
}
break;
default:
ret = -1;