aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/error.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-10-14 11:39:43 -0700
committerGitHub <[email protected]>2016-10-14 11:39:43 -0700
commit98e71596fb48ce7cdabd46e581f32a9a54398cce (patch)
tree7d600055248d58edfccd4ed5577c32c86bac3ff2 /openssl/src/error.rs
parentRename NoPadding to None (diff)
parentIgnore DTLS tests on Windows/ARM for now (diff)
downloadrust-openssl-98e71596fb48ce7cdabd46e581f32a9a54398cce.tar.xz
rust-openssl-98e71596fb48ce7cdabd46e581f32a9a54398cce.zip
Merge pull request #464 from alexcrichton/systest
Add support for OpenSSL 1.1.0
Diffstat (limited to 'openssl/src/error.rs')
-rw-r--r--openssl/src/error.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/openssl/src/error.rs b/openssl/src/error.rs
index d76e7cbd..f54d7bda 100644
--- a/openssl/src/error.rs
+++ b/openssl/src/error.rs
@@ -71,7 +71,7 @@ impl Error {
match unsafe { ffi::ERR_get_error() } {
0 => None,
- err => Some((Error(err))),
+ err => Some(Error(err)),
}
}
@@ -121,6 +121,7 @@ impl error::Error for Error {
fn get_lib(err: c_ulong) -> &'static str {
unsafe {
let cstr = ffi::ERR_lib_error_string(err);
+ assert!(!cstr.is_null(), "bad lib: {}", err);
let bytes = CStr::from_ptr(cstr as *const _).to_bytes();
str::from_utf8(bytes).unwrap()
}
@@ -129,6 +130,7 @@ fn get_lib(err: c_ulong) -> &'static str {
fn get_func(err: c_ulong) -> &'static str {
unsafe {
let cstr = ffi::ERR_func_error_string(err);
+ assert!(!cstr.is_null(), "bad func: {}", err);
let bytes = CStr::from_ptr(cstr as *const _).to_bytes();
str::from_utf8(bytes).unwrap()
}
@@ -137,6 +139,7 @@ fn get_func(err: c_ulong) -> &'static str {
fn get_reason(err: c_ulong) -> &'static str {
unsafe {
let cstr = ffi::ERR_reason_error_string(err);
+ assert!(!cstr.is_null(), "bad reason: {}", err);
let bytes = CStr::from_ptr(cstr as *const _).to_bytes();
str::from_utf8(bytes).unwrap()
}