diff options
author | Joe Orton <jorton@apache.org> | 2005-10-19 16:05:19 +0000 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2005-10-19 16:05:19 +0000 |
commit | df3c58a27c166b21a8d5f5667fa8807d878edaa5 (patch) | |
tree | 760f858fda08cda5aaff3cb093c64bd3c9ce761f | |
parent | 149c903e5f897f9285428306668041311494f1a9 (diff) | |
download | apr-df3c58a27c166b21a8d5f5667fa8807d878edaa5.tar.gz |
* file_io/unix/seek.c (setptr): Don't ignore errors from
apr_file_flush.
* test/testfile.c (test_fail_read_flush): Add test.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@326593 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/unix/seek.c | 5 | ||||
-rw-r--r-- | test/testfile.c | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/file_io/unix/seek.c b/file_io/unix/seek.c index 48368cda5..656947af6 100644 --- a/file_io/unix/seek.c +++ b/file_io/unix/seek.c @@ -22,7 +22,10 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) 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; } diff --git a/test/testfile.c b/test/testfile.c index d27fb0764..c6e14c965 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -795,6 +795,16 @@ static void test_fail_read_flush(abts_case *tc, void *data) 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); } |