net: sendmmsg should only return an error if no messages were sent
authorAnton Blanchard <anton@samba.org>
Thu, 4 Aug 2011 14:07:38 +0000 (14:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Aug 2011 10:31:02 +0000 (03:31 -0700)
commit68bdad83ddbe9fd67f24d0558d81c088d14e2f55
tree62bdf029ab504ef38ab664436940e0b262327a86
parentcb833955dcaaa46e717e2373de878032fee651bb
net: sendmmsg should only return an error if no messages were sent

sendmmsg uses a similar error return strategy as recvmmsg but it
turns out to be a confusing way to communicate errors.

The current code stores the error code away and returns it on the next
sendmmsg call. This means a call with completely valid arguments could
get an error from a previous call.

Change things so we only return an error if no datagrams could be sent.
If less than the requested number of messages were sent, the application
must retry starting at the first failed one and if the problem is
persistent the error will be returned.

This matches the behaviour of other syscalls like read/write - it
is not an error if less than the requested number of elements are sent.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable <stable@kernel.org> [3.0+]
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c