diff --git a/ChangeLog b/ChangeLog index 43c393433..d215a6151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,10 @@ - mouring@cvs.openbsd.org 2001/05/08 19:45:25 [misc.c misc.h scp.c sftp.c] Use addargs() in sftp plus some clean up of addargs(). OK Markus + - markus@cvs.openbsd.org 2001/05/06 21:45:14 + [clientloop.c] + use atomicio for flushing stdout/stderr bufs. thanks to + jbw@izanami.cee.hw.ac.uk - (bal) UseLogin patch for Solaris/UNICOS. Patch by Wayne Davison - (bal) ./configure support to disable SIA on OSF1. Patch by @@ -5375,4 +5379,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1210 2001/05/08 20:42:28 mouring Exp $ +$Id: ChangeLog,v 1.1211 2001/05/08 23:58:37 mouring Exp $ diff --git a/clientloop.c b/clientloop.c index 2bc5b54aa..3294b0cfe 100644 --- a/clientloop.c +++ b/clientloop.c @@ -59,7 +59,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: clientloop.c,v 1.67 2001/05/04 23:47:34 markus Exp $"); +RCSID("$OpenBSD: clientloop.c,v 1.68 2001/05/06 21:45:14 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -936,25 +936,21 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) buffer_append(&stderr_buffer, buf, strlen(buf)); } /* Output any buffered data for stdout. */ - while (buffer_len(&stdout_buffer) > 0) { - len = write(fileno(stdout), buffer_ptr(&stdout_buffer), + if (buffer_len(&stdout_buffer) > 0) { + len = atomicio(write, fileno(stdout), buffer_ptr(&stdout_buffer), buffer_len(&stdout_buffer)); - if (len <= 0) { + if (len != buffer_len(&stdout_buffer)) error("Write failed flushing stdout buffer."); - break; - } buffer_consume(&stdout_buffer, len); stdout_bytes += len; } /* Output any buffered data for stderr. */ - while (buffer_len(&stderr_buffer) > 0) { - len = write(fileno(stderr), buffer_ptr(&stderr_buffer), + if (buffer_len(&stderr_buffer) > 0) { + len = atomicio(write, fileno(stderr), buffer_ptr(&stderr_buffer), buffer_len(&stderr_buffer)); - if (len <= 0) { + if (len != buffer_len(&stderr_buffer)) error("Write failed flushing stderr buffer."); - break; - } buffer_consume(&stderr_buffer, len); stderr_bytes += len; }