diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 19075afa688c84ab5ab268fe02a6317e239313c7..6073bcd0a6cc8713b0d2bdbe6be3635c1be57b6c 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
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 340c1b0c22d389600d201c22ec7a9a81afdc44cb..f36ae50272ac99748ffab66b929e72f50b28a793 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -64,6 +64,7 @@ class LLInventoryCollectFunctor;
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryModel
 {
+	LOG_CLASS(LLInventoryModel);
 public:
 	friend class LLInventoryModelFetchDescendentsResponder;