=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/nchan.c,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -u -r1.23.2.1 -r1.23.2.2 --- src/usr.bin/ssh/nchan.c 2001/09/27 19:03:54 1.23.2.1 +++ src/usr.bin/ssh/nchan.c 2001/11/15 00:15:19 1.23.2.2 @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: nchan.c,v 1.23.2.1 2001/09/27 19:03:54 jason Exp $"); +RCSID("$OpenBSD: nchan.c,v 1.23.2.2 2001/11/15 00:15:19 miod Exp $"); #include "ssh1.h" #include "ssh2.h" @@ -432,7 +432,7 @@ } int -chan_is_dead(Channel *c) +chan_is_dead(Channel *c, int send) { if (c->type == SSH_CHANNEL_ZOMBIE) { debug("channel %d: zombie", c->self); @@ -461,7 +461,16 @@ "read": "write"); } else { if (!(c->flags & CHAN_CLOSE_SENT)) { - chan_send_close2(c); + if (send) { + chan_send_close2(c); + } else { + /* channel would be dead if we sent a close */ + if (c->flags & CHAN_CLOSE_RCVD) { + debug("channel %d: almost dead", + c->self); + return 1; + } + } } if ((c->flags & CHAN_CLOSE_SENT) && (c->flags & CHAN_CLOSE_RCVD)) {