1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4-lib/socket: Return the original EMSGSIZE when sendto() and setsockopt() both fail

This ensures that should we be unable to increase the socket size, we return an
error that the application layer above might expect and be able to make
as reasonable response to (such as switching to a stream-based transport).

This fixes up c692bb02b0.

As suggested by metze in https://bugzilla.samba.org/show_bug.cgi?id=9697#c4

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2013-03-04 14:07:38 +11:00 committed by Stefan Metzmacher
parent b9b6375699
commit 50b42d1c5b

View File

@ -295,7 +295,7 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock,
if (setsockopt(sock->fd, SOL_SOCKET, SO_SNDBUF, &bufsize,
sizeof(bufsize)) == -1)
{
return map_nt_error_from_unix_common(errno);
return map_nt_error_from_unix_common(EMSGSIZE);
}
len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len);
}