[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Thu Nov 3 23:19:17 UTC 2016


The branch master has been updated
       via  62dd3351a16089aedb0f1e62e3b6df371c93389c (commit)
      from  00bb5504cc62693e05ff4e699f379011c55ecc84 (commit)


- Log -----------------------------------------------------------------
commit 62dd3351a16089aedb0f1e62e3b6df371c93389c
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Nov 3 18:48:23 2016 +0100

    Don't assume to know the shared library extension
    
    test/shlibloadtest.c assumes all Unix style platforms use .so as
    shared library extension.  This is not the case for Mac OS X, which
    uses .dylib.  Instead of this, have the test recipe find out the
    extension from configuration data.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1844)

-----------------------------------------------------------------------

Summary of changes:
 test/recipes/90-test_shlibload.t | 17 ++++++++---------
 test/shlibloadtest.c             | 19 +++----------------
 2 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/test/recipes/90-test_shlibload.t b/test/recipes/90-test_shlibload.t
index dc35613..9058ba5 100644
--- a/test/recipes/90-test_shlibload.t
+++ b/test/recipes/90-test_shlibload.t
@@ -22,16 +22,15 @@ plan skip_all => "Test only supported in a shared build" if disabled("shared");
 
 plan tests => 3;
 
-ok(run(test(["shlibloadtest", "-crypto_first",
-             $unified_info{sharednames}->{libcrypto},
-             $unified_info{sharednames}->{libssl}])),
+my $libcrypto =
+    $unified_info{sharednames}->{libcrypto}.$target{shared_extension_simple};
+my $libssl =
+    $unified_info{sharednames}->{libssl}.$target{shared_extension_simple};
+
+ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl])),
    "running shlibloadtest -crypto_first");
-ok(run(test(["shlibloadtest", "-ssl_first",
-             $unified_info{sharednames}->{libcrypto},
-             $unified_info{sharednames}->{libssl}])),
+ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl])),
    "running shlibloadtest -ssl_first");
-ok(run(test(["shlibloadtest", "-just_crypto",
-             $unified_info{sharednames}->{libcrypto},
-             $unified_info{sharednames}->{libssl}])),
+ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl])),
    "running shlibloadtest -just_crypto");
 
diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c
index 20030d9..eea2e3a 100644
--- a/test/shlibloadtest.c
+++ b/test/shlibloadtest.c
@@ -44,22 +44,9 @@ typedef void * SHLIB;
 typedef void * SHLIB_SYM;
 # define SHLIB_INIT NULL
 
-# define SHARED_LIBRARY_SUFFIX ".so"
-
-static int shlib_load(char *filename, SHLIB *lib)
+static int shlib_load(const char *filename, SHLIB *lib)
 {
-    char *tmpfile;
-    size_t filenamelen = strlen(filename);
-
-    /* Total length = base filename len + suffix len + 1 for NULL terminator */
-    tmpfile = malloc(filenamelen + sizeof(SHARED_LIBRARY_SUFFIX) + 1);
-    if (tmpfile == NULL)
-        return 0;
-    strcpy(tmpfile, filename);
-    strcpy(tmpfile + filenamelen, SHARED_LIBRARY_SUFFIX);
-
-    *lib = dlopen(tmpfile, RTLD_GLOBAL | RTLD_LAZY);
-    free(tmpfile);
+    *lib = dlopen(filename, RTLD_GLOBAL | RTLD_LAZY);
 
     if (*lib == NULL)
         return 0;
@@ -90,7 +77,7 @@ typedef HINSTANCE SHLIB;
 typedef void * SHLIB_SYM;
 # define SHLIB_INIT 0
 
-static int shlib_load(char *filename, SHLIB *lib)
+static int shlib_load(const char *filename, SHLIB *lib)
 {
     *lib = LoadLibraryA(filename);
     if (*lib == NULL)


More information about the openssl-commits mailing list