From 8102ccb7983caf9ef09d16c3de8342eacf5ca03e Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 25 Jul 2011 17:54:32 +0100 Subject: [PATCH] writev_emu: stop on the first incomplete write Just like standard writev, we should only move on to the next block if all the previous ones have been successfully written out. Otherwise there is a potential for data loss and/or confusing push functions. --- lib/gnutls_buffers.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 48f1c8e..0c48d26 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -393,6 +393,9 @@ _gnutls_writev_emu (gnutls_session_t session, const giovec_t * giovec, break; total += ret; + + if (ret != giovec[j].iov_len) + break; } if (total > 0) -- 1.7.5.4