]> granicus.if.org Git - apache/commitdiff
add ap_full_read() and ap_full_write(). they guarantee to read/write the
authorGreg Stein <gstein@apache.org>
Sat, 15 Jul 2000 02:07:21 +0000 (02:07 +0000)
committerGreg Stein <gstein@apache.org>
Sat, 15 Jul 2000 02:07:21 +0000 (02:07 +0000)
    full buffer unless an error occurs.
use the new functions in SDBM and DAV. [and Subversion]
Win32 and OS/2 can directly include/use file_io/unix/fullrw.c since it is
    written in terms of other APR functions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85850 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/fs/repos.c

index a741637ba66d052ee1cf890d3c56543b142604ec..d0647bbb9b63ba3fbf2fab1922c73c87720998b7 100644 (file)
@@ -254,22 +254,6 @@ static void dav_format_time(int style, ap_time_t sec, char *buf)
            tms.tm_hour, tms.tm_min, tms.tm_sec);
 }
 
-static ap_status_t dav_sync_write(ap_file_t *f, const char *buf,
-                                  ap_size_t bufsize)
-{
-    ap_status_t status;
-    ap_ssize_t amt;
-    
-    do {
-       amt = bufsize;
-       status = ap_write(f, buf, &amt);
-       bufsize -= amt;
-       buf += amt;
-    } while (status == APR_SUCCESS && bufsize > 0);
-
-    return status;
-}
-
 static dav_error * dav_fs_copymove_file(
     int is_move,
     ap_pool_t * p,
@@ -328,7 +312,7 @@ static dav_error * dav_fs_copymove_file(
        }
 
         /* write any bytes that were read (applies to APR_EOF, too) */
-        if (dav_sync_write(outf, pbuf->buf, len) != APR_SUCCESS) {
+        if (ap_full_write(outf, pbuf->buf, len, NULL) != APR_SUCCESS) {
             int save_errno = errno;
 
            ap_close(inf);
@@ -825,7 +809,7 @@ static dav_error * dav_fs_write_stream(dav_stream *stream,
 {
     ap_status_t status;
 
-    status = dav_sync_write(stream->f, buf, bufsize);
+    status = ap_full_write(stream->f, buf, bufsize, NULL);
     if (status == APR_ENOSPC) {
         return dav_new_error(stream->p, HTTP_INSUFFICIENT_STORAGE, 0,
                              "There is not enough storage to write to "