Skip to content

Commit

Permalink
Make openssl not cleanup at exit, which can lead to race conditions.
Browse files Browse the repository at this point in the history
Fixes #1293.
  • Loading branch information
orium committed Jul 27, 2020
1 parent 5cf2c2d commit 7f8a970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openssl-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ pub fn init() {
static INIT: Once = Once::new();

INIT.call_once(|| unsafe {
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, ptr::null_mut());
OPENSSL_init_ssl(
OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_NO_ATEXIT,
ptr::null_mut(),
);
})
}

Expand Down
2 changes: 2 additions & 0 deletions openssl-sys/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,8 @@ cfg_if! {

#[cfg(ossl110)]
pub const OPENSSL_INIT_LOAD_SSL_STRINGS: u64 = 0x00200000;
#[cfg(ossl110)]
pub const OPENSSL_INIT_NO_ATEXIT: u64 = 0x00080000;

extern "C" {
#[cfg(ossl110)]
Expand Down

0 comments on commit 7f8a970

Please sign in to comment.