diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-17 13:31:48 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-17 13:31:48 -0500 |
commit | a7b642d358f0e5649642db3084143b224f7e977d (patch) | |
tree | 2abc31a48494a2874c28bc7566c7864af362a1ea /indra/llcommon/llsys.cpp | |
parent | 3ed8f8907665d8700199a1181a5dd106a6804edb (diff) | |
parent | 64c45cbd1ace677456db56d1a506f2fe44b6e9c6 (diff) |
merge
Diffstat (limited to 'indra/llcommon/llsys.cpp')
-rw-r--r-- | indra/llcommon/llsys.cpp | 18 |
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 |