Skip to content

Commit 7f8a970

Browse files
committed
Make openssl not cleanup at exit, which can lead to race conditions.
Fixes #1293.
1 parent 5cf2c2d commit 7f8a970

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

openssl-sys/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ pub fn init() {
102102
static INIT: Once = Once::new();
103103

104104
INIT.call_once(|| unsafe {
105-
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, ptr::null_mut());
105+
OPENSSL_init_ssl(
106+
OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_NO_ATEXIT,
107+
ptr::null_mut(),
108+
);
106109
})
107110
}
108111

openssl-sys/src/ssl.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,8 @@ cfg_if! {
13981398

13991399
#[cfg(ossl110)]
14001400
pub const OPENSSL_INIT_LOAD_SSL_STRINGS: u64 = 0x00200000;
1401+
#[cfg(ossl110)]
1402+
pub const OPENSSL_INIT_NO_ATEXIT: u64 = 0x00080000;
14011403

14021404
extern "C" {
14031405
#[cfg(ossl110)]

0 commit comments

Comments
 (0)