summaryrefslogtreecommitdiff
path: root/package/source/zippackage/ZipPackage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'package/source/zippackage/ZipPackage.cxx')
-rw-r--r--package/source/zippackage/ZipPackage.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 66e40cb9d410..33ed9c1bc023 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1395,6 +1395,14 @@ void SAL_CALL ZipPackage::commitChanges()
try
{
xOutputStream = m_xStream->getOutputStream();
+
+ // Make sure we avoid a situation where the current position is
+ // not zero, but the underlying file is truncated in the
+ // meantime.
+ uno::Reference<io::XSeekable> xSeekable(xOutputStream, uno::UNO_QUERY);
+ if (xSeekable.is())
+ xSeekable->seek(0);
+
uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY_THROW );
// after successful truncation the original file contents are already lost