From df3c58a27c166b21a8d5f5667fa8807d878edaa5 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Wed, 19 Oct 2005 16:05:19 +0000 Subject: * 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 --- file_io/unix/seek.c | 5 ++++- test/testfile.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.1