apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r513205 - in /apr/apr/trunk/file_io: os2/readwrite.c unix/readwrite.c
Date Thu, 01 Mar 2007 07:13:55 GMT
Author: pquerna
Date: Wed Feb 28 23:13:54 2007
New Revision: 513205

URL: http://svn.apache.org/viewvc?view=rev&rev=513205
Log:
Only try to flush when the file is in buffered mode, inside apr_file_writev.

Modified:
    apr/apr/trunk/file_io/os2/readwrite.c
    apr/apr/trunk/file_io/unix/readwrite.c

Modified: apr/apr/trunk/file_io/os2/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/os2/readwrite.c?view=diff&rev=513205&r1=513204&r2=513205
==============================================================================
--- apr/apr/trunk/file_io/os2/readwrite.c (original)
+++ apr/apr/trunk/file_io/os2/readwrite.c Wed Feb 28 23:13:54 2007
@@ -197,13 +197,15 @@
 
 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;

Modified: apr/apr/trunk/file_io/unix/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/readwrite.c?view=diff&rev=513205&r1=513204&r2=513205
==============================================================================
--- apr/apr/trunk/file_io/unix/readwrite.c (original)
+++ apr/apr/trunk/file_io/unix/readwrite.c Wed Feb 28 23:13:54 2007
@@ -239,15 +239,18 @@
 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;



Mime
View raw message