diff options
Diffstat (limited to 'src/openssl.c')
-rw-r--r-- | src/openssl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c index 76a409e..7985b1f 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <errno.h> /* errno */ | 36 | #include <errno.h> /* errno */ |
37 | 37 | ||
38 | #include <sys/types.h> /* ssize_t pid_t */ | 38 | #include <sys/types.h> /* ssize_t pid_t */ |
39 | #if !defined __sun | 39 | #if !defined __sun && !defined _AIX |
40 | #include <sys/sysctl.h> /* CTL_KERN KERN_RANDOM RANDOM_UUID KERN_URND KERN_ARND sysctl(2) */ | 40 | #include <sys/sysctl.h> /* CTL_KERN KERN_RANDOM RANDOM_UUID KERN_URND KERN_ARND sysctl(2) */ |
41 | #endif | 41 | #endif |
42 | #include <sys/time.h> /* struct timeval gettimeofday(2) */ | 42 | #include <sys/time.h> /* struct timeval gettimeofday(2) */ |
@@ -4646,7 +4646,7 @@ static int randL_stir(struct randL_state *st, unsigned rqstd) { | |||
4646 | #endif | 4646 | #endif |
4647 | 4647 | ||
4648 | if (count < rqstd) { | 4648 | if (count < rqstd) { |
4649 | #if defined O_CLOEXEC | 4649 | #if defined O_CLOEXEC && (!defined _AIX /* O_CLOEXEC overflows int */) |
4650 | int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC); | 4650 | int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC); |
4651 | #else | 4651 | #else |
4652 | int fd = open("/dev/urandom", O_RDONLY); | 4652 | int fd = open("/dev/urandom", O_RDONLY); |
@@ -4938,6 +4938,10 @@ int luaopen__openssl_rand(lua_State *L) { | |||
4938 | * | 4938 | * |
4939 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 4939 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
4940 | 4940 | ||
4941 | #ifndef HAVE_DLADDR | ||
4942 | #define HAVE_DLADDR (!defined _AIX) | ||
4943 | #endif | ||
4944 | |||
4941 | static struct { | 4945 | static struct { |
4942 | pthread_mutex_t *lock; | 4946 | pthread_mutex_t *lock; |
4943 | int nlock; | 4947 | int nlock; |
@@ -5022,6 +5026,7 @@ static int mt_init(void) { | |||
5022 | * Prevent loader from unlinking us if we've registered a callback | 5026 | * Prevent loader from unlinking us if we've registered a callback |
5023 | * with OpenSSL by taking another reference to ourselves. | 5027 | * with OpenSSL by taking another reference to ourselves. |
5024 | */ | 5028 | */ |
5029 | #if HAVE_DLADDR | ||
5025 | if (bound && !mt_state.dlref) { | 5030 | if (bound && !mt_state.dlref) { |
5026 | Dl_info info; | 5031 | Dl_info info; |
5027 | 5032 | ||
@@ -5035,6 +5040,7 @@ static int mt_init(void) { | |||
5035 | goto leave; | 5040 | goto leave; |
5036 | } | 5041 | } |
5037 | } | 5042 | } |
5043 | #endif | ||
5038 | 5044 | ||
5039 | leave: | 5045 | leave: |
5040 | pthread_mutex_unlock(&mutex); | 5046 | pthread_mutex_unlock(&mutex); |