summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-01-12 13:16:28 -0800
committerRichard Linden <none@none>2012-01-12 13:16:28 -0800
commitf1c27071047e776536f8aa963b83f8772275e7c3 (patch)
treea0a74e20cdb688471af361c8fc078260bd7988dc /indra/llcommon
parent3dfb1536fa3bb85f6648a76591e80c3feea9eb83 (diff)
parent26829e6fa2de6e59f46ba340ca7ad6c430728470 (diff)
Automated merge with https://bitbucket.org/lindenlab/viewer-development
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