summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-15 19:40:58 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-15 19:40:58 +0100
commit59446d550522660c47065622812308da190d6a89 (patch)
tree5b88fd6f84b538556461dc6af8289b0120557f16
parent1c638961543909e897bc343d260f300202687723 (diff)
be gentler on negative-offset reads - just do nothing instead of asserting. from bao's review.
(transplanted from 061b8b55838634425455ebc4ac046462dfc0e5f1)
-rw-r--r--indra/llcommon/llapr.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 7330b00bcf..f030867ec4 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -535,6 +535,11 @@ S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset)
//static
S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool)
{
+ if (offset < 0)
+ {
+ return 0; // do nothing, negative offsets don't make sense for reads
+ }
+
//*****************************************
apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY);
//*****************************************
@@ -543,10 +548,10 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb
return 0;
}
- llassert(offset >= 0);
-
if (offset > 0)
+ {
offset = LLAPRFile::seek(file_handle, APR_SET, offset);
+ }
apr_size_t bytes_read;
if (offset < 0)