diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/channels.c b/channels.c index bf11716b8..65cf2ab9e 100644 --- a/channels.c +++ b/channels.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: channels.c,v 1.133 2001/09/17 20:52:47 markus Exp $"); | 42 | RCSID("$OpenBSD: channels.c,v 1.134 2001/09/17 21:04:01 markus Exp $"); |
43 | 43 | ||
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | #include "ssh1.h" | 45 | #include "ssh1.h" |
@@ -1292,14 +1292,17 @@ static int | |||
1292 | channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | 1292 | channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) |
1293 | { | 1293 | { |
1294 | struct termios tio; | 1294 | struct termios tio; |
1295 | u_char *data; | ||
1296 | u_int dlen; | ||
1295 | int len; | 1297 | int len; |
1296 | 1298 | ||
1297 | /* Send buffered output data to the socket. */ | 1299 | /* Send buffered output data to the socket. */ |
1298 | if (c->wfd != -1 && | 1300 | if (c->wfd != -1 && |
1299 | FD_ISSET(c->wfd, writeset) && | 1301 | FD_ISSET(c->wfd, writeset) && |
1300 | buffer_len(&c->output) > 0) { | 1302 | buffer_len(&c->output) > 0) { |
1301 | len = write(c->wfd, buffer_ptr(&c->output), | 1303 | data = buffer_ptr(&c->output); |
1302 | buffer_len(&c->output)); | 1304 | dlen = buffer_len(&c->output); |
1305 | len = write(c->wfd, data, dlen); | ||
1303 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | 1306 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) |
1304 | return 1; | 1307 | return 1; |
1305 | if (len <= 0) { | 1308 | if (len <= 0) { |
@@ -1316,7 +1319,7 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1316 | } | 1319 | } |
1317 | return -1; | 1320 | return -1; |
1318 | } | 1321 | } |
1319 | if (compat20 && c->isatty) { | 1322 | if (compat20 && c->isatty && dlen >= 1 && data[0] != '\r') { |
1320 | if (tcgetattr(c->wfd, &tio) == 0 && | 1323 | if (tcgetattr(c->wfd, &tio) == 0 && |
1321 | !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { | 1324 | !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { |
1322 | /* | 1325 | /* |