about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/aws-c-cal/aws-c-cal-musl-compat.patch
blob: 2cf1d4e81e0b590fb1e8452186c7cedccd8f8d9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Emil Lerch <emil@lerch.org>
Date: Wed, 28 Apr 2021 17:46:24 -0700
Subject: [PATCH] Allow dlopen to fail on musl systems

Now that references are forced when linking statically, the assertion is
no longer necessary. See https://github.com/awslabs/aws-c-cal/pull/54
---
 source/unix/openssl_platform_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source/unix/openssl_platform_init.c b/source/unix/openssl_platform_init.c
index 5266ecc1..99f210bd 100644
--- a/source/unix/openssl_platform_init.c
+++ b/source/unix/openssl_platform_init.c
@@ -496,7 +502,6 @@ static enum aws_libcrypto_version s_resolve_libcrypto(void) {
     /* Try to auto-resolve against what's linked in/process space */
     FLOGF("searching process and loaded modules");
     void *process = dlopen(NULL, RTLD_NOW);
-    AWS_FATAL_ASSERT(process && "Unable to load symbols from process space");
     enum aws_libcrypto_version result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_LC, process);
     if (result == AWS_LIBCRYPTO_NONE) {
         result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_0_2, process);
@@ -504,7 +509,9 @@ static enum aws_libcrypto_version s_resolve_libcrypto(void) {
     if (result == AWS_LIBCRYPTO_NONE) {
         result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_1_1, process);
     }
-    dlclose(process);
+    if (process) {
+        dlclose(process);
+    }
 
     if (result == AWS_LIBCRYPTO_NONE) {
         FLOGF("libcrypto symbols were not statically linked, searching for shared libraries");