File pacemaker-libcommon-dlsym-error.patch of Package pacemaker.3577

commit d6775487ca0ed68e2ac8285606090b7341a6086e
Author: David Shane Holden <dpejesh@yahoo.com>
Date:   Wed Jan 20 00:16:29 2016 -0500

    lib/common: check return value of dlsym() and not dlerror()
    
    dlsym() on FreeBSD can set dlerror() even though it sucessfully returns
    the address of the function.  Without this change pacemaker will fail
    with the following error:
    
    Undefined symbol "_nss_cache_cycle_prevention_function"

diff --git a/lib/common/utils.c b/lib/common/utils.c
index 24933f6..1cb8a6c 100644
--- a/lib/common/utils.c
+++ b/lib/common/utils.c
@@ -2270,7 +2270,8 @@ find_library_function(void **handle, const char *lib, const char *fn, gboolean f
     }
 
     a_function = dlsym(*handle, fn);
-    if ((error = dlerror()) != NULL) {
+    if (a_function == NULL) {
+        error = dlerror();
         crm_err("%sCould not find %s in %s: %s", fatal ? "Fatal: " : "", fn, lib, error);
         if (fatal) {
             crm_exit(DAEMON_RESPAWN_STOP);
openSUSE Build Service is sponsored by