LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0148-crypto-Improve-load-error-message.patch of Package erlang (Project home:Ledest:erlang:20)

From 6ee8cc56db53fd7951fb3bacfd6621c72fdf3ced Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Fri, 16 Mar 2018 21:22:29 +0100
Subject: [PATCH 6/6] crypto: Improve load error message

to only suggest missing OpenSSL if dlopen fails (load_failed).
---
 lib/crypto/src/crypto.erl | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index ec2a1dba0a..46775989ae 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -847,8 +847,13 @@ on_load() ->
     case Status of
 	ok -> ok;
 	{error, {E, Str}} ->
-	    error_logger:error_msg("Unable to load crypto library. Failed with error:~n\"~p, ~s\"~n"
-				   "OpenSSL might not be installed on this system.~n",[E,Str]),
+            Fmt = "Unable to load crypto library. Failed with error:~n\"~p, ~s\"~n~s",
+            Extra = case E of
+                        load_failed ->
+                            "OpenSSL might not be installed on this system.\n";
+                        _ -> ""
+                    end,
+	    error_logger:error_msg(Fmt, [E,Str,Extra]),
 	    Status
     end.
 
-- 
2.16.3