• David S. Miller's avatar
    [NET]: Zero length write() on socket should not simply return 0. · e79ad711
    David S. Miller authored
    This fixes kernel bugzilla #5731
    
    It should generate an empty packet for datagram protocols when the
    socket is connected, for one.
    
    The check is doubly-wrong because all that a write() can be is a
    sendmsg() call with a NULL msg_control and a single entry iovec.  No
    special semantics should be assigned to it, therefore the zero length
    check should be removed entirely.
    
    This matches the behavior of BSD and several other systems.
    
    Alan Cox notes that SuSv3 says the behavior of a zero length write on
    non-files is "unspecified", but that's kind of useless since BSD has
    defined this behavior for a quarter century and BSD is essentially
    what application folks code to.
    
    Based upon a patch from Stephen Hemminger.
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e79ad711
socket.c 54.5 KB