From: Emil Lerch 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");