[patch] resend - spurious ENOTCONN in shutdown()

From: Zack Weinberg (zack@wolery.cumb.org)
Date: Sat Feb 19 2000 - 12:26:42 EST

  • Next message: Khimenko Victor: "Problems with IDE IRQ detection ?"

    This patch seems to have vanished, so I'm resending it.

    If you close down the write end of a TCP socket with shutdown(sock, SHUT_WR)
    and then come back later and try to close its read side, shutdown will
    return -ENOTCONN. This breaks some user applications that expect to
    be able to shutdown read and write separately and in any order. For
    example, openssh 1.2.2 wants to do this.

    This patch causes inet_shutdown() to check tcp_connected() only if
    shutting down write, which does more or less the Right Thing.

    zw

    --- af_inet.c.old Sat Feb 12 14:38:29 2000
    +++ af_inet.c Tue Feb 15 13:33:49 2000
    @@ -825,7 +825,7 @@
                     return(-ENOTCONN);
             if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
                     sock->state = SS_CONNECTED;
    - if (!tcp_connected(sk->state))
    + if ((how & SEND_SHUTDOWN) && !tcp_connected(sk->state))
                     return(-ENOTCONN);
             sk->shutdown |= how;
             if (sk->prot->shutdown)

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Feb 19 2000 - 13:18:30 EST