[Libreoffice-commits] core.git: desktop/source

Stephan Bergmann sbergman at redhat.com
Sun Jul 2 20:19:06 UTC 2017


 desktop/source/deployment/dp_persmap.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 6cfce7dd5f5e6b8af2ba50fcf8a287db0a4a1d17
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Jul 2 22:18:03 2017 +0200

    Handle osl::File::setPos failure
    
    Change-Id: Icf21c14f44250e1680dd7521dbb0e1260614a573

diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx
index d52aa38d89b8..d193193b93b3 100644
--- a/desktop/source/deployment/dp_persmap.cxx
+++ b/desktop/source/deployment/dp_persmap.cxx
@@ -157,9 +157,13 @@ void PersistentMap::open()
 void PersistentMap::readAll()
 {
     // prepare for re-reading the map-file
-    const osl::FileBase::RC nRes = m_MapFile.setPos( osl_Pos_Absolut, 0);
-    (void)nRes;
     m_entries.clear();
+    const osl::FileBase::RC nRes = m_MapFile.setPos( osl_Pos_Absolut, 0);
+    if (nRes != osl::FileBase::E_None)
+    {
+        SAL_WARN("desktop.deployment", "setPos failed with " << +nRes);
+        return;
+    }
 
     // read header and check magic
     char aHeaderBytes[ sizeof(PmapMagic)];
@@ -218,7 +222,11 @@ void PersistentMap::flush()
 
     // write header magic
     const osl::FileBase::RC nRes = m_MapFile.setPos( osl_Pos_Absolut, 0);
-    (void)nRes;
+    if (nRes != osl::FileBase::E_None)
+    {
+        SAL_WARN("desktop.deployment", "setPos failed with " << +nRes);
+        return;
+    }
     sal_uInt64 nBytesWritten = 0;
     m_MapFile.write( PmapMagic, sizeof(PmapMagic), nBytesWritten);
 


More information about the Libreoffice-commits mailing list