aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_dl.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-10-26 18:30:34 +0000
committerRichard Levitte <levitte@openssl.org>2000-10-26 18:30:34 +0000
commitd9efa3616a46c4f5ab10ee54ae8b68061774bf2b (patch)
treee7e4c7a395a90babe09fcb9e38193f2773b4b77c /crypto/dso/dso_dl.c
parent51c8dc37dd4d655cf44f07d16dc985627a8e3577 (diff)
downloadopenssl-d9efa3616a46c4f5ab10ee54ae8b68061774bf2b.tar.gz
For the operating systems where it matters, it is sometimes good to
translate library names by only adding ".so" to them without prepending them with "lib". Add the flag DSO_FLAG_NAME_TRANSLATION_EXT_ONLY for that purpose.
Diffstat (limited to 'crypto/dso/dso_dl.c')
-rw-r--r--crypto/dso/dso_dl.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c
index 6dd1b19755..43078604af 100644
--- a/crypto/dso/dso_dl.c
+++ b/crypto/dso/dso_dl.c
@@ -240,16 +240,18 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
static char *dl_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_DL_NAME_CONVERTER,
@@ -257,7 +259,12 @@ static char *dl_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);