summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2012-01-12 10:58:12 -0800
committerLeslie Linden <leslie@lindenlab.com>2012-01-12 10:58:12 -0800
commit50a8fb4d2eee7857fb3a4f3cce6b819e34b1fd82 (patch)
tree38d88e594f82352796574a2ade57bad2423562f4 /indra/llcommon
parent1307fad7c9f7a1130242a4de7e0144ba4dea6297 (diff)
parent37c68057c92f5a21a3d21b4ac01690a1cf4cf8e4 (diff)
Merge with latest from viewer-experience
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llsys.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 19075afa68..6073bcd0a6 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -1364,11 +1364,21 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
if (! src) goto err;
- do
+ while ((bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE, src)) > 0)
{
- bytes = (S32)fread(buffer, sizeof(U8), COMPRESS_BUFFER_SIZE,src);
- gzwrite(dst, buffer, bytes);
- } while(feof(src) == 0);
+ if (gzwrite(dst, buffer, bytes) <= 0)
+ {
+ llwarns << "gzwrite failed: " << gzerror(dst, NULL) << llendl;
+ goto err;
+ }
+ }
+
+ if (ferror(src))
+ {
+ llwarns << "Error reading " << srcfile << llendl;
+ goto err;
+ }
+
gzclose(dst);
dst = NULL;
#if LL_WINDOWS