This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch crypto-174
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/crypto-174 by this push:
     new c78ce489 Show actual path used [skip ci]
c78ce489 is described below

commit c78ce48949481262d1ff3f7db5ca0a8ecee1a155
Author: Sebb <[email protected]>
AuthorDate: Mon Nov 6 22:47:06 2023 +0000

    Show actual path used [skip ci]
---
 .../org/apache/commons/crypto/DynamicLoader.c      | 50 +++++++++++-----------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/main/native/org/apache/commons/crypto/DynamicLoader.c 
b/src/main/native/org/apache/commons/crypto/DynamicLoader.c
index 186c1002..57fff14a 100644
--- a/src/main/native/org/apache/commons/crypto/DynamicLoader.c
+++ b/src/main/native/org/apache/commons/crypto/DynamicLoader.c
@@ -50,36 +50,34 @@ HMODULE open_library(JNIEnv *env)
     openssl = LoadLibrary(lib);
 #endif
 
-  }
-//   Did we succeed?
-  if (!openssl)
-  {
-      char msg[1000];
+    //   Did we succeed?
+    if (!openssl)
+    {
+        char msg[1000];
 #ifdef UNIX
-    snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", 
COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
-    dlerror()); // returns char*
+        snprintf(msg, sizeof(msg), "Cannot load '%s' (%s)!", libraryPath, 
dlerror()); // returns char*
 #endif
 #ifdef WINDOWS
-    // Crude method to convert most likely errors to string
-    DWORD lastError = GetLastError();
-    char *lastmsg;
-    if (lastError == 126)
-    {
-        lastmsg = "specified module cannot be found";
-    }
-    else if (lastError == 193)
-    {
-        lastmsg = "module is not a valid Win32 application";
-    }
-    else
-    {
-        lastmsg = "unknown error - check online Windows documentation";
-    }
-    snprintf(msg, sizeof(msg), "Cannot load %s (%d: %s)!", 
COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
-    lastError, lastmsg);
+        // Crude method to convert most likely errors to string
+        DWORD lastError = GetLastError();
+        char *lastmsg;
+        if (lastError == 126)
+        {
+            lastmsg = "specified module cannot be found";
+        }
+        else if (lastError == 193)
+        {
+            lastmsg = "module is not a valid Win32 application";
+        }
+        else
+        {
+            lastmsg = "unknown error - check online Windows documentation";
+        }
+        snprintf(msg, sizeof(msg), "Cannot load '%s' (%d: %s)!", libraryPath, 
lastError, lastmsg);
 #endif
-    THROW(env, "java/lang/UnsatisfiedLinkError", msg);
-    return 0;
+        THROW(env, "java/lang/UnsatisfiedLinkError", msg);
+        return 0;
+    }
   }
   return openssl;
 }

Reply via email to