• Anton Blanchard's avatar
    net: sendmmsg should only return an error if no messages were sent · 365f1cd4
    Anton Blanchard authored
    commit 728ffb86 upstream.
    
    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: default avatarAnton Blanchard <anton@samba.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    365f1cd4
socket.c 80.8 KB