From: Greg Stein Date: Sat, 15 Jul 2000 02:07:21 +0000 (+0000) Subject: add ap_full_read() and ap_full_write(). they guarantee to read/write the X-Git-Tag: APACHE_2_0_ALPHA_5~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3b192ab05be729d602a65697ffbc4d63982e9a7;p=apache add ap_full_read() and ap_full_write(). they guarantee to read/write the 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 --- diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index a741637ba6..d0647bbb9b 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -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 "