summaryrefslogtreecommitdiffstats
path: root/crypto/comp/c_zlib.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-04-12 16:12:53 +0200
committerRichard Levitte <levitte@openssl.org>2016-04-13 11:36:46 +0200
commit5a5c0b953f8f97b4e604da494a65de034bbaaceb (patch)
tree1efab2a23a5c94082c6ef3b8fce7eadf396db832 /crypto/comp/c_zlib.c
parent0c9b1534265a59d099886fc916b859e55d268d8b (diff)
Remake the way dynamic zlib is loaded
Instead of absolute hard coding of the libz library name, have it use the macro LIBZ, which is set to defaults we know in case it's undefined. This allows our configuration to set something that's sane on current or older platforms, and allows the user to override it by defining LIBZ themselves. Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/comp/c_zlib.c')
-rw-r--r--crypto/comp/c_zlib.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c
index 20376b6451..6dd76846c5 100644
--- a/crypto/comp/c_zlib.c
+++ b/crypto/comp/c_zlib.c
@@ -256,12 +256,19 @@ COMP_METHOD *COMP_zlib(void)
COMP_METHOD *meth = &zlib_method_nozlib;
#ifdef ZLIB_SHARED
- if (!zlib_loaded) {
-# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
- zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
-# else
- zlib_dso = DSO_load(NULL, "z", NULL, 0);
+ /* LIBZ may be externally defined, and we should respect that value */
+# ifndef LIBZ
+# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
+# define LIBZ "ZLIB1"
+# elif defined(OPENSSL_SYS_VMS)
+# define LIBZ "LIBZ"
+# else
+# define LIBZ "z"
+# endif
# endif
+
+ if (!zlib_loaded) {
+ zlib_dso = DSO_load(NULL, LIBZ, NULL, 0);
if (zlib_dso != NULL) {
p_compress = (compress_ft) DSO_bind_func(zlib_dso, "compress");
p_inflateEnd