summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2007-02-28 18:05:37 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2007-02-28 18:05:37 +0000
commitf7d28f45e0ad7488a0c508eba0f72a8c1ce5efd9 (patch)
treece6297b0e38c56a6b7097dd2a51899bb63b050d0 /file_io
parentb833dcb827b0376223064622a5b6c4536c9514b1 (diff)
downloadlibapr-f7d28f45e0ad7488a0c508eba0f72a8c1ce5efd9.tar.gz
Fix apr_file_writev when buffering is enabled by forcing a flush, rather than writing underneath the write buffer.
PR: 41197 Submitted By: Davi Arnaut git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@512882 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/os2/readwrite.c6
-rw-r--r--file_io/unix/readwrite.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c
index 2eb011e82..354641abb 100644
--- a/file_io/os2/readwrite.c
+++ b/file_io/os2/readwrite.c
@@ -197,6 +197,12 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
{
+ apr_status_t rv = apr_file_flush(thefile);
+
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+
int bytes;
if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
*nbytes = 0;
diff --git a/file_io/unix/readwrite.c b/file_io/unix/readwrite.c
index 320735d68..56d9bfff6 100644
--- a/file_io/unix/readwrite.c
+++ b/file_io/unix/readwrite.c
@@ -239,6 +239,12 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec,
apr_size_t nvec, apr_size_t *nbytes)
{
+ apr_status_t rv = apr_file_flush(thefile);
+
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+
#ifdef HAVE_WRITEV
apr_ssize_t bytes;