Handle OSX ".dynlib" DSO extension.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 15 Jul 2009 17:58:57 +0000 (17:58 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 15 Jul 2009 17:58:57 +0000 (17:58 +0000)
crypto/dso/dso_dlfcn.c

index 168c25b9e8cb989cf24f05fd22d56879bb8786d8..06953f3bd593be492b2466c2c27fad6ac77a4900 100644 (file)
@@ -351,6 +351,15 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
        return(merged);
        }
 
+#ifdef OPENSSL_SYS_MAC
+#define DSO_ext        ".dynlib"
+#define DSO_extlen 7
+#else
+#define DSO_ext        ".so"
+#define DSO_extlen 3
+#endif
+
+
 static char *dlfcn_name_converter(DSO *dso, const char *filename)
        {
        char *translated;
@@ -361,8 +370,8 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
        transform = (strstr(filename, "/") == NULL);
        if(transform)
                {
-               /* We will convert this to "%s.so" or "lib%s.so" */
-               rsize += 3;     /* The length of ".so" */
+               /* We will convert this to "%s.so" or "lib%s.so" etc */
+               rsize += DSO_extlen;    /* The length of ".so" */
                if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
                        rsize += 3; /* The length of "lib" */
                }
@@ -376,9 +385,9 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
        if(transform)
                {
                if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
-                       sprintf(translated, "lib%s.so", filename);
+                       sprintf(translated, "lib%s" DSO_ext, filename);
                else
-                       sprintf(translated, "%s.so", filename);
+                       sprintf(translated, "%s" DSO_ext, filename);
                }
        else
                sprintf(translated, "%s", filename);