[Libreoffice-commits] core.git: include/LibreOfficeKit

Tor Lillqvist tml at collabora.com
Fri Apr 24 07:42:35 PDT 2015


 include/LibreOfficeKit/LibreOfficeKitInit.h |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 9a8d327e023d59ad02378edf4cb9ccf2478fcdf5
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 24 17:41:28 2015 +0300

    Don't be fooled by the dummy libsofficeapp.so in the mergedlib case
    
    Change-Id: If4bc9ee28091680fad78fbba585e0470f87dc830

diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 6058b0e..f1966c7 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -22,10 +22,10 @@ extern "C"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #ifndef _WIN32
 
-    #include <unistd.h>
     #include "dlfcn.h"
 
     #ifdef  _AIX
@@ -74,9 +74,6 @@ extern "C"
 
 #else
 
-    #include <io.h>
-    #define F_OK 00
-
     #include <windows.h>
     #define TARGET_LIB        "sofficeapp" ".dll"
     #define TARGET_MERGED_LIB "mergedlo" ".dll"
@@ -178,9 +175,12 @@ static LibreOfficeKit *lok_init_2( const char *install_path,  const char *user_p
     dlhandle = _dlopen(imp_lib);
     if (!dlhandle)
     {
-        // If TARGET_LIB exists, but dlopen failed for some reason,
-        // don't try TARGET_MERGED_LIB.
-        if (access(imp_lib, F_OK) == 0)
+        // If TARGET_LIB exists, and likely is a real library (not a
+        // small one-line text stub as in the --enable-mergedlib
+        // case), but dlopen failed for some reason, don't try
+        // TARGET_MERGED_LIB.
+        struct stat st;
+        if (stat(imp_lib, &st) == 0 && st.st_size > 100)
         {
             fprintf(stderr, "failed to open library '%s': %s\n",
                     imp_lib, _dlerror());


More information about the Libreoffice-commits mailing list