summaryrefslogtreecommitdiff
path: root/nchan.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-10-12 11:35:04 +1000
committerDamien Miller <djm@mindrot.org>2001-10-12 11:35:04 +1000
commit3ec2759ad40f054c152c753db046ac55f9670d14 (patch)
tree3b26532eed14eaf485834a531a4d187cde1b1149 /nchan.c
parent4e088e4de02b6c813b498a1270df85e8136c4499 (diff)
- (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.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/nchan.c b/nchan.c
index 91c34dec8..2680f0a68 100644
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: nchan.c,v 1.31 2001/07/17 21:04:57 markus Exp $"); 26RCSID("$OpenBSD: nchan.c,v 1.32 2001/10/10 22:18:47 markus Exp $");
27 27
28#include "ssh1.h" 28#include "ssh1.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -432,7 +432,7 @@ chan_mark_dead(Channel *c)
432} 432}
433 433
434int 434int
435chan_is_dead(Channel *c) 435chan_is_dead(Channel *c, int send)
436{ 436{
437 if (c->type == SSH_CHANNEL_ZOMBIE) { 437 if (c->type == SSH_CHANNEL_ZOMBIE) {
438 debug("channel %d: zombie", c->self); 438 debug("channel %d: zombie", c->self);
@@ -461,7 +461,16 @@ chan_is_dead(Channel *c)
461 "read": "write"); 461 "read": "write");
462 } else { 462 } else {
463 if (!(c->flags & CHAN_CLOSE_SENT)) { 463 if (!(c->flags & CHAN_CLOSE_SENT)) {
464 chan_send_close2(c); 464 if (send) {
465 chan_send_close2(c);
466 } else {
467 /* channel would be dead if we sent a close */
468 if (c->flags & CHAN_CLOSE_RCVD) {
469 debug("channel %d: almost dead",
470 c->self);
471 return 1;
472 }
473 }
465 } 474 }
466 if ((c->flags & CHAN_CLOSE_SENT) && 475 if ((c->flags & CHAN_CLOSE_SENT) &&
467 (c->flags & CHAN_CLOSE_RCVD)) { 476 (c->flags & CHAN_CLOSE_RCVD)) {