diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-04-24 17:41:28 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-04-24 17:41:51 +0300 |
commit | 9a8d327e023d59ad02378edf4cb9ccf2478fcdf5 (patch) | |
tree | 8612912dedad9ba350091b693a79f97fab44a85b /include | |
parent | 002368eaaeaaf1e5b8e9ba151de1b22ef663e0bb (diff) |
Don't be fooled by the dummy libsofficeapp.so in the mergedlib case
Change-Id: If4bc9ee28091680fad78fbba585e0470f87dc830
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitInit.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h index 6058b0eca1d1..f1966c764605 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()); |