diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-04-04 06:18:02 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-04-04 06:18:02 +0000 |
commit | 7deb13f146e0bd45546e7340245d50ce465bdf41 (patch) | |
tree | 11c0797bb201b3c0e916c733a63a3424a09c0954 /usr.bin/ssh/channels.c | |
parent | 76c54b2e595fef0f0206e4dbb836dc81fa893015 (diff) |
close efd on eof
Diffstat (limited to 'usr.bin/ssh/channels.c')
-rw-r--r-- | usr.bin/ssh/channels.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 5e0bd650221..4c67ade1814 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -17,7 +17,7 @@ */ #include "includes.h" -RCSID("$Id: channels.c,v 1.44 2000/04/03 07:07:15 markus Exp $"); +RCSID("$Id: channels.c,v 1.45 2000/04/04 06:18:01 markus Exp $"); #include "ssh.h" #include "packet.h" @@ -642,6 +642,7 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) char buf[16*1024]; int len; +/** XXX handle drain efd, too */ if (c->efd != -1) { if (c->extended_usage == CHAN_EXTENDED_WRITE && FD_ISSET(c->efd, writeset) && @@ -659,7 +660,12 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) len = read(c->efd, buf, sizeof(buf)); debug("channel %d: read %d from efd %d", c->self, len, c->efd); - if (len > 0) + if (len == 0) { + debug("channel %d: closing efd %d", + c->self, c->efd); + close(c->efd); + c->efd = -1; + } else if (len > 0) buffer_append(&c->extended, buf, len); } } |