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

David Tardon dtardon at redhat.com
Mon Dec 7 04:13:49 PST 2015


 include/LibreOfficeKit/LibreOfficeKitInit.h |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 764ec21307009a84b2611fed5cb20069caa6d566
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Dec 7 13:10:50 2015 +0100

    improve error message for nonexist. path
    
    ... which is currently somewhat misleading, because it mentions
    libmerged.so.
    
    Change-Id: I1ab21ce0fe2f94eba1831c2c977d900827f320f1

diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 66d5283..880f11e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -155,6 +155,13 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
     if (!install_path)
         return NULL;
 
+    struct stat dir_st;
+    if (stat(install_path, &dir_st) != 0)
+    {
+        fprintf(stderr, "installation path \"%s\" does not exist\n", install_path);
+        return NULL;
+    }
+
     // allocate large enough buffer
     partial_length = strlen(install_path);
     imp_lib = (char *) malloc(partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2);
commit 7f73ea2e3975b305e09467eb7980a3d01cd37de9
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Dec 7 13:09:07 2015 +0100

    tdf#96243 don't crash if LibO install. wasn't found
    
    Change-Id: I538e7238feb711a7d71faf745033264894f688f4

diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index a5b5035..66d5283 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -220,6 +220,8 @@ static LibreOfficeKit *lok_init_2( const char *install_path,  const char *user_p
     LokHookFunction2 *pSym2;
 
     dlhandle = lok_dlopen(install_path, &imp_lib);
+    if (!dlhandle)
+        return NULL;
 
     pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2");
     if (!pSym2)


More information about the Libreoffice-commits mailing list