summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-07-25 17:54:32 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-07-25 19:13:01 +0200
commit12fb2da52e63c104b1c92932745d1d231d72c32b (patch)
tree0d6d9c7a800bea8bab40635a7e6200b950474a15
parent01c4439909aab068e4549b9330528aa71d5ba69a (diff)
downloadgnutls-12fb2da52e63c104b1c92932745d1d231d72c32b.tar.gz
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. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/gnutls_buffers.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index 48f1c8e11e..0c48d26b67 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)