summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-01-16 23:18:33 +1100
committerDamien Miller <djm@mindrot.org>2011-01-16 23:18:33 +1100
commitcfd6e4f57fc8489ed4065be06d85de3f30575fe2 (patch)
tree4ccaf98368853d997ac043d9088e85409b3e891f
parent6fb6fd566267da4f36499078caf46da5291f4b8c (diff)
- djm@cvs.openbsd.org 2011/01/16 12:05:59
[clientloop.c] a couple more tweaks to the post-close protocol 1 stderr/stdout flush: now that we use atomicio(), convert them from while loops to if statements add test and cast to compile cleanly with -Wsigned
-rw-r--r--ChangeLog5
-rw-r--r--clientloop.c20
2 files changed, 14 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index d16a9fb4..a0282b73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
[sshconnect.c]
reset the SIGPIPE handler when forking to execute child processes;
ok dtucker@
+ - djm@cvs.openbsd.org 2011/01/16 12:05:59
+ [clientloop.c]
+ a couple more tweaks to the post-close protocol 1 stderr/stdout flush:
+ now that we use atomicio(), convert them from while loops to if statements
+ add test and cast to compile cleanly with -Wsigned
20110114
- OpenBSD CVS Sync
diff --git a/clientloop.c b/clientloop.c
index 325657ba..f6c1444a 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.230 2011/01/16 11:50:05 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.231 2011/01/16 12:05:59 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1590,25 +1590,23 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
}
/* Output any buffered data for stdout. */
- while (buffer_len(&stdout_buffer) > 0) {
+ if (buffer_len(&stdout_buffer) > 0) {
len = atomicio(vwrite, fileno(stdout),
buffer_ptr(&stdout_buffer), buffer_len(&stdout_buffer));
- if (len != buffer_len(&stdout_buffer)) {
+ if (len < 0 || (u_int)len != buffer_len(&stdout_buffer))
error("Write failed flushing stdout buffer.");
- break;
- }
- buffer_consume(&stdout_buffer, len);
+ else
+ buffer_consume(&stdout_buffer, len);
}
/* Output any buffered data for stderr. */
- while (buffer_len(&stderr_buffer) > 0) {
+ if (buffer_len(&stderr_buffer) > 0) {
len = atomicio(vwrite, fileno(stderr),
buffer_ptr(&stderr_buffer), buffer_len(&stderr_buffer));
- if (len != buffer_len(&stderr_buffer)) {
+ if (len < 0 || (u_int)len != buffer_len(&stderr_buffer))
error("Write failed flushing stderr buffer.");
- break;
- }
- buffer_consume(&stderr_buffer, len);
+ else
+ buffer_consume(&stderr_buffer, len);
}
/* Clear and free any buffers. */