You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2005/10/19 18:05:25 UTC

svn commit: r326593 - in /apr/apr/trunk: file_io/unix/seek.c test/testfile.c

Author: jorton
Date: Wed Oct 19 09:05:19 2005
New Revision: 326593

URL: http://svn.apache.org/viewcvs?rev=326593&view=rev
Log:
* file_io/unix/seek.c (setptr): Don't ignore errors from
apr_file_flush.

* test/testfile.c (test_fail_read_flush): Add test.

Modified:
    apr/apr/trunk/file_io/unix/seek.c
    apr/apr/trunk/test/testfile.c

Modified: apr/apr/trunk/file_io/unix/seek.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/unix/seek.c?rev=326593&r1=326592&r2=326593&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/seek.c (original)
+++ apr/apr/trunk/file_io/unix/seek.c Wed Oct 19 09:05:19 2005
@@ -22,7 +22,10 @@
     int rc;
 
     if (thefile->direction == 1) {
-        apr_file_flush(thefile);
+        rc = apr_file_flush(thefile);
+        if (rc) {
+            return rc;
+        }
         thefile->bufpos = thefile->direction = thefile->dataRead = 0;
     }
 

Modified: apr/apr/trunk/test/testfile.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/test/testfile.c?rev=326593&r1=326592&r2=326593&view=diff
==============================================================================
--- apr/apr/trunk/test/testfile.c (original)
+++ apr/apr/trunk/test/testfile.c Wed Oct 19 09:05:19 2005
@@ -795,6 +795,16 @@
     ABTS_ASSERT(tc, "gets should flush buffered write and fail",
                 rv != APR_SUCCESS && rv != APR_EOF);
 
+    /* Likewise for seek. */
+    {
+        apr_off_t offset = 0;
+
+        rv = apr_file_seek(f, APR_SET, &offset);
+    }
+
+    ABTS_ASSERT(tc, "seek should flush buffered write and fail",
+                rv != APR_SUCCESS && rv != APR_EOF);
+
     apr_file_close(f);
 }