diff options
author | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-04 16:50:08 +0000 |
---|---|---|
committer | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-04 16:50:08 +0000 |
commit | f9118af6d678fee5a0166668ffa1da8a2fa28cd7 (patch) | |
tree | 4df54553bf8b6c19dd39780e6866885aa9a105df /file_io/os2 | |
parent | cebe05eb2ade70c6d1a9731ec987efe1d9f7d106 (diff) | |
download | libapr-f9118af6d678fee5a0166668ffa1da8a2fa28cd7.tar.gz |
OS/2: Add missing locking in apr_file_seek() for buffered files.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@930716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/seek.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/file_io/os2/seek.c b/file_io/os2/seek.c index a8d13fe28..7afba3077 100644 --- a/file_io/os2/seek.c +++ b/file_io/os2/seek.c @@ -27,7 +27,6 @@ static apr_status_t setptr(apr_file_t *thefile, unsigned long pos ) ULONG rc; if (thefile->direction == 1) { - /* XXX: flush here is not mutex protected */ apr_status_t rv = apr_file_flush(thefile); if (rv != APR_SUCCESS) { @@ -65,6 +64,10 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh int rc = EINVAL; apr_finfo_t finfo; + if (thefile->mutex) { + apr_thread_mutex_lock(thefile->mutex); + } + switch (where) { case APR_SET: rc = setptr(thefile, *offset); @@ -82,6 +85,11 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh } *offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; + + if (thefile->mutex) { + apr_thread_mutex_unlock(thefile->mutex); + } + return rc; } else { switch (where) { |