You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2005/03/15 23:24:00 UTC

svn commit: r157597 - apr/apr/branches/1.1.x/file_io/unix/fullrw.c

Author: pquerna
Date: Tue Mar 15 14:24:00 2005
New Revision: 157597

URL: http://svn.apache.org/viewcvs?view=rev&rev=157597
Log:
backport fix for writev_full from trunk.

Modified:
    apr/apr/branches/1.1.x/file_io/unix/fullrw.c

Modified: apr/apr/branches/1.1.x/file_io/unix/fullrw.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.1.x/file_io/unix/fullrw.c?view=diff&r1=157596&r2=157597
==============================================================================
--- apr/apr/branches/1.1.x/file_io/unix/fullrw.c (original)
+++ apr/apr/branches/1.1.x/file_io/unix/fullrw.c Tue Mar 15 14:24:00 2005
@@ -66,30 +66,19 @@
                                                apr_size_t nvec,
                                                apr_size_t *bytes_written)
 {
-    apr_status_t status;
+    apr_status_t rv = APR_SUCCESS;
+    int i;
+    apr_size_t amt = 0;
     apr_size_t total = 0;
 
-    do {
-        apr_size_t i, amt;
-        status = apr_file_writev(thefile, vec, nvec, &amt);
- 
-       /* We assume that writev will only write complete iovec areas.
-        * Incomplete writes inside a single area are not supported.
-        * This should be safe according to SuS v2. 
-        */
-        for (i = 0; i < nvec; i++) {
-            total += vec[i].iov_len;
-            if (total >= amt) {
-                vec = &vec[i+1];
-                nvec -= i+1;
-                break;
-            }
-        }
-    } while (status == APR_SUCCESS && nvec > 0);
+    for (i = 0; i < nvec && rv == APR_SUCCESS; i++) {
+        rv = apr_file_write_full(thefile, vec[i].iov_base, 
+                                 vec[i].iov_len, &amt);
+        total += amt;
+    }
 
     if (bytes_written != NULL)
         *bytes_written = total;
 
-    return status;
+    return rv;
 }
-