]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
writev_emu: stop on the first incomplete write
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 25 Jul 2011 16:54:32 +0000 (17:54 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 25 Jul 2011 17:13:07 +0000 (19:13 +0200)
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>
lib/gnutls_buffers.c

index 198a495346c9b3764d7d0e64da61c06a4f1bc344..71584330990ef11ec759ded3a5843bcab472536d 100644 (file)
@@ -325,6 +325,9 @@ _gnutls_writev_emu (gnutls_session_t session, gnutls_transport_ptr_t fd, const g
         break;
 
       total += ret;
+
+      if (ret != giovec[j].iov_len)
+        break;
     }
 
   if (total > 0)