summaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_dlfcn.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dso/dso_dlfcn.c')
-rw-r--r--crypto/dso/dso_dlfcn.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c
index 279b37b0c8..22e5059dd8 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -252,16 +252,19 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
static char *dlfcn_name_converter(DSO *dso, const char *filename)
{
char *translated;
- int len, transform;
+ int len, rsize, transform;
len = strlen(filename);
+ rsize = len + 1;
transform = (strstr(filename, "/") == NULL);
if(transform)
- /* We will convert this to "lib%s.so" */
- translated = OPENSSL_malloc(len + 7);
- else
- /* We will simply duplicate filename */
- translated = OPENSSL_malloc(len + 1);
+ {
+ /* We will convert this to "%s.so" or "lib%s.so" */
+ rsize += 3; /* The length of ".so" */
+ if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
+ rsize += 3; /* The length of "lib" */
+ }
+ translated = OPENSSL_malloc(rsize);
if(translated == NULL)
{
DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
@@ -269,7 +272,12 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
return(NULL);
}
if(transform)
- sprintf(translated, "lib%s.so", filename);
+ {
+ if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
+ sprintf(translated, "lib%s.so", filename);
+ else
+ sprintf(translated, "%s.so", filename);
+ }
else
sprintf(translated, "%s", filename);
return(translated);