diff options
author | Brian Havard <bjh@apache.org> | 2006-02-22 11:26:16 +0000 |
---|---|---|
committer | Brian Havard <bjh@apache.org> | 2006-02-22 11:26:16 +0000 |
commit | ea8dacd4895599a4aaa46df74d432526ea59eacc (patch) | |
tree | 7845f359e9653ef4307f547cbec87f174b3053a5 /file_io/os2 | |
parent | d7b9f2977b138eb711711bbd7f189f87466a2648 (diff) | |
download | apr-ea8dacd4895599a4aaa46df74d432526ea59eacc.tar.gz |
OS/2: Add proper error handling when internal calls to apr_file_flush() fail
within apr_file_read(), apr_file_gets() and apr_file_seek().
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@379754 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/readwrite.c | 12 | ||||
-rw-r--r-- | file_io/os2/seek.c | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c index b7b97931c..fde47589e 100644 --- a/file_io/os2/readwrite.c +++ b/file_io/os2/readwrite.c @@ -42,7 +42,13 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size apr_thread_mutex_lock(thefile->mutex); if (thefile->direction == 1) { - apr_file_flush(thefile); + int rv = apr_file_flush(thefile); + + if (rv != APR_SUCCESS) { + apr_thread_mutex_unlock(thefile->mutex); + return rv; + } + thefile->bufpos = 0; thefile->direction = 0; thefile->dataRead = 0; @@ -300,6 +306,10 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) readlen = 1; rv = apr_file_read(thefile, str+i, &readlen); + if (rv != APR_SUCCESS) { + break; + } + if (readlen != 1) { rv = APR_EOF; break; diff --git a/file_io/os2/seek.c b/file_io/os2/seek.c index 40b02a815..5918a7c75 100644 --- a/file_io/os2/seek.c +++ b/file_io/os2/seek.c @@ -27,7 +27,12 @@ static apr_status_t setptr(apr_file_t *thefile, unsigned long pos ) ULONG rc; if (thefile->direction == 1) { - apr_file_flush(thefile); + apr_status_t rv = apr_file_flush(thefile); + + if (rv != APR_SUCCESS) { + return rv; + } + thefile->bufpos = thefile->direction = thefile->dataRead = 0; } |