diff options
author | Damien Miller <djm@mindrot.org> | 2001-10-12 11:35:04 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2001-10-12 11:35:04 +1000 |
commit | 3ec2759ad40f054c152c753db046ac55f9670d14 (patch) | |
tree | 3b26532eed14eaf485834a531a4d187cde1b1149 /nchan.c | |
parent | 4e088e4de02b6c813b498a1270df85e8136c4499 (diff) | |
download | openssh-git-3ec2759ad40f054c152c753db046ac55f9670d14.tar.gz |
- (djm) OpenBSD CVS Sync
- markus@cvs.openbsd.org 2001/10/10 22:18:47
[channels.c channels.h clientloop.c nchan.c serverloop.c]
[session.c session.h]
try to keep channels open until an exit-status message is sent.
don't kill the login shells if the shells stdin/out/err is closed.
this should now work:
ssh -2n localhost 'exec > /dev/null 2>&1; sleep 10; exit 5'; echo ?
Diffstat (limited to 'nchan.c')
-rw-r--r-- | nchan.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: nchan.c,v 1.31 2001/07/17 21:04:57 markus Exp $"); +RCSID("$OpenBSD: nchan.c,v 1.32 2001/10/10 22:18:47 markus Exp $"); #include "ssh1.h" #include "ssh2.h" @@ -432,7 +432,7 @@ chan_mark_dead(Channel *c) } 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 @@ chan_is_dead(Channel *c) "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)) { |