diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-17 03:21:27 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-17 03:21:27 +0000 |
commit | b6147ab9e986c698f2a9a5e099a7ed199333cb94 (patch) | |
tree | e4662bf82eb137c92a6a0024b281e472047430fd /channels.c | |
parent | c8b3f476765c2f24cb50462e397262028fc28a2e (diff) |
- markus@cvs.openbsd.org 2001/05/16 22:09:21
[channels.c nchan.c]
more select() error fixes (don't set rfd/wfd to -1).
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/channels.c b/channels.c index 9397d48e5..55cef42c2 100644 --- a/channels.c +++ b/channels.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: channels.c,v 1.115 2001/05/09 22:51:57 markus Exp $"); | 43 | RCSID("$OpenBSD: channels.c,v 1.116 2001/05/16 22:09:20 markus Exp $"); |
44 | 44 | ||
45 | #include <openssl/rsa.h> | 45 | #include <openssl/rsa.h> |
46 | #include <openssl/dsa.h> | 46 | #include <openssl/dsa.h> |
@@ -893,7 +893,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
893 | char buf[16*1024]; | 893 | char buf[16*1024]; |
894 | int len; | 894 | int len; |
895 | 895 | ||
896 | if (c->rfd != -1 && | 896 | if (c->istate == CHAN_INPUT_OPEN && |
897 | FD_ISSET(c->rfd, readset)) { | 897 | FD_ISSET(c->rfd, readset)) { |
898 | len = read(c->rfd, buf, sizeof(buf)); | 898 | len = read(c->rfd, buf, sizeof(buf)); |
899 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | 899 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) |
@@ -932,7 +932,8 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
932 | int len; | 932 | int len; |
933 | 933 | ||
934 | /* Send buffered output data to the socket. */ | 934 | /* Send buffered output data to the socket. */ |
935 | if (c->wfd != -1 && | 935 | if ((c->ostate == CHAN_OUTPUT_OPEN || |
936 | c->ostate == CHAN_OUTPUT_WAIT_DRAIN) && | ||
936 | FD_ISSET(c->wfd, writeset) && | 937 | FD_ISSET(c->wfd, writeset) && |
937 | buffer_len(&c->output) > 0) { | 938 | buffer_len(&c->output) > 0) { |
938 | len = write(c->wfd, buffer_ptr(&c->output), | 939 | len = write(c->wfd, buffer_ptr(&c->output), |