summaryrefslogtreecommitdiff
path: root/indra/llcommon/llsys.cpp
diff options
context:
space:
mode:
authorprep <prep@lindenlab.com>2012-01-19 14:39:06 -0500
committerprep <prep@lindenlab.com>2012-01-19 14:39:06 -0500
commitdc6b871db8e5e5247d8ef88150efb18186b5e6c8 (patch)
tree65a14a4731b74a8c22c11142b46ecb1a48a448b5 /indra/llcommon/llsys.cpp
parente2ef5a5edce6a01724d91fde5b471b0bae18d045 (diff)
parent146f0c25504cc16458cb20312eba63b04d26389d (diff)
merge
Diffstat (limited to 'indra/llcommon/llsys.cpp')
-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