summaryrefslogtreecommitdiff
path: root/file_io/os2
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2006-02-22 11:26:16 +0000
committerBrian Havard <bjh@apache.org>2006-02-22 11:26:16 +0000
commitea8dacd4895599a4aaa46df74d432526ea59eacc (patch)
tree7845f359e9653ef4307f547cbec87f174b3053a5 /file_io/os2
parentd7b9f2977b138eb711711bbd7f189f87466a2648 (diff)
downloadapr-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.c12
-rw-r--r--file_io/os2/seek.c7
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;
}