diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index a472e6ac703814d016ed6c938f95625d544bab2d..199d784952ca087b3f1ecd952c72af318002fa27 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -172,7 +172,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
         LLUniqueFile filep = LLFile::fopen(mFilePath, TEXT("ab"));
         if (filep)
         {
-            fwrite((const void*)buffer, bytes, 1, filep);
+            fseek(filep, 0L, SEEK_END);
+            long fsize = ftell(filep);
+
+            fwrite((const void*)buffer, 1, bytes, filep);
+
+            mPosition = fsize + bytes;
 
             success = TRUE;
         }
@@ -182,9 +187,9 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
         LLUniqueFile filep = LLFile::fopen(mFilePath, TEXT("wb"));
         if (filep)
         {
-            fwrite((const void*)buffer, bytes, 1, filep);
+            fwrite((const void*)buffer, 1, bytes, filep);
 
-            mPosition += bytes;
+            mPosition = bytes;
 
             success = TRUE;
         }