* Update ffi_util.rs

* Update rocksdb.rs
master
hh9527 8 years ago committed by GitHub
parent 7f2188c39d
commit 2bace2ca0d
  1. 3
      src/ffi_util.rs
  2. 7
      src/rocksdb.rs

@ -15,11 +15,10 @@
use libc::{self, c_char, c_void};
use std::ffi::CStr;
use std::str;
pub fn error_message(ptr: *const c_char) -> String {
let cstr = unsafe { CStr::from_ptr(ptr as *const _) };
let s = str::from_utf8(cstr.to_bytes()).unwrap().to_owned();
let s = String::from_utf8_lossy(cstr.to_bytes()).into();
unsafe {
libc::free(ptr as *mut c_void);
}

@ -911,10 +911,9 @@ fn errors_do_stuff() {
// The DB will still be open when we try to destroy it and the lock should fail.
match DB::destroy(&opts, path) {
Err(s) => {
assert!(s ==
Error::new("IO error: lock _rust_rocksdb_error/LOCK: No \
locks available"
.to_owned()))
let message = s.to_string();
assert!(message.find("IO error:").is_some());
assert!(message.find("_rust_rocksdb_error/LOCK:").is_some());
}
Ok(_) => panic!("should fail"),
}

Loading…
Cancel
Save