• Ian Lance Taylor's avatar
    os, net, internal/poll: return consistent error for closed socket · fb4b4342
    Ian Lance Taylor authored
    In the past we returned "use of closed network connection" when using
    a closed network descriptor in some way. In CL 36799 that was changed
    to return "use of closed file or network connection". Because programs
    have no access to a value of this error type (see issue #4373) they
    resort to doing direct string comparisons (see issue #19252). This CL
    restores the old error string so that we don't break programs
    unnecessarily with the 1.9 release.
    
    This adds a test to the net package for the expected string.
    
    For symmetry check that the os package returns the expected error,
    which for os already exists as os.ErrClosed.
    
    Updates #4373.
    Fixed #19252.
    
    Change-Id: I5b83fd12cfa03501a077cad9336499b819f4a38b
    Reviewed-on: https://go-review.googlesource.com/39997
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    fb4b4342
sendfile_linux.go 1.1 KB