[Libreoffice-commits] core.git: vcl/generic

Noel Grandin noel at peralex.com
Mon Nov 10 03:58:36 PST 2014


 vcl/generic/print/genpspgraphics.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 8fc7e856ccc3ba19158c6d86d507d9b7a0b140b8
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Nov 10 13:54:37 2014 +0200

    cid#736944 Time of check time of use
    
    Change-Id: Ie9160e8d5ee7f8416a4526a280db23316488a2a1

diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 3b2ce07..db904da 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1247,12 +1247,15 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
     OString aSysPath = rMgr.getFontFileSysPath( aFont );
 
 #if defined( UNX )
-    struct stat aStat;
-    if( stat( aSysPath.getStr(), &aStat ) )
-        return NULL;
     int fd = open( aSysPath.getStr(), O_RDONLY );
     if( fd < 0 )
         return NULL;
+    struct stat aStat;
+    if( fstat( fd, &aStat ) )
+    {
+        close( fd );
+        return NULL;
+    }
     void* pFile = mmap( NULL, aStat.st_size, PROT_READ, MAP_SHARED, fd, 0 );
     close( fd );
     if( pFile == MAP_FAILED )


More information about the Libreoffice-commits mailing list