diff options
author | Paul Querna <pquerna@apache.org> | 2007-03-01 07:13:54 +0000 |
---|---|---|
committer | Paul Querna <pquerna@apache.org> | 2007-03-01 07:13:54 +0000 |
commit | 5805df99c0aaf0ec85b7b4d88fc42620f9bd2245 (patch) | |
tree | 516209dc89c9c1e8e50c40fc068262bd4bd01c3f | |
parent | f2cc92c2ecb75c88cae110b5ccf16cf3d467befb (diff) | |
download | apr-5805df99c0aaf0ec85b7b4d88fc42620f9bd2245.tar.gz |
Only try to flush when the file is in buffered mode, inside apr_file_writev.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@513205 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/os2/readwrite.c | 10 | ||||
-rw-r--r-- | file_io/unix/readwrite.c | 13 |
2 files changed, 14 insertions, 9 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c index 354641abb..d680dcc1c 100644 --- a/file_io/os2/readwrite.c +++ b/file_io/os2/readwrite.c @@ -197,13 +197,15 @@ 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); + int bytes; - if (rv != APR_SUCCESS) { - return rv; + if (thefile->buffered) { + 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; return errno; diff --git a/file_io/unix/readwrite.c b/file_io/unix/readwrite.c index 56d9bfff6..7ba0e0e45 100644 --- a/file_io/unix/readwrite.c +++ b/file_io/unix/readwrite.c @@ -239,15 +239,18 @@ 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); +#ifdef HAVE_WRITEV + apr_ssize_t bytes; +#endif - if (rv != APR_SUCCESS) { - return rv; + if (thefile->buffered) { + apr_status_t rv = apr_file_flush(thefile); + if (rv != APR_SUCCESS) { + return rv; + } } #ifdef HAVE_WRITEV - apr_ssize_t bytes; - if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) { *nbytes = 0; return errno; |