summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/serverloop.c b/serverloop.c
index 0b44182ce..d6089d822 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.76 2001/07/17 21:04:58 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.77 2001/09/17 21:04:02 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -349,12 +349,15 @@ static void
349process_output(fd_set * writeset) 349process_output(fd_set * writeset)
350{ 350{
351 struct termios tio; 351 struct termios tio;
352 u_char *data;
353 u_int dlen;
352 int len; 354 int len;
353 355
354 /* Write buffered data to program stdin. */ 356 /* Write buffered data to program stdin. */
355 if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) { 357 if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
356 len = write(fdin, buffer_ptr(&stdin_buffer), 358 data = buffer_ptr(&stdin_buffer);
357 buffer_len(&stdin_buffer)); 359 dlen = buffer_len(&stdin_buffer);
360 len = write(fdin, data, dlen);
358 if (len < 0 && (errno == EINTR || errno == EAGAIN)) { 361 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
359 /* do nothing */ 362 /* do nothing */
360 } else if (len <= 0) { 363 } else if (len <= 0) {
@@ -369,7 +372,8 @@ process_output(fd_set * writeset)
369 fdin = -1; 372 fdin = -1;
370 } else { 373 } else {
371 /* Successful write. */ 374 /* Successful write. */
372 if (fdin_is_tty && tcgetattr(fdin, &tio) == 0 && 375 if (fdin_is_tty && dlen >= 1 && data[0] != '\r' &&
376 tcgetattr(fdin, &tio) == 0 &&
373 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { 377 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
374 /* 378 /*
375 * Simulate echo to reduce the impact of 379 * Simulate echo to reduce the impact of