Skip to content
Snippets Groups Projects
Verified Commit 7049359c authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Hack around closedir crashing

parent 594bcd75
No related branches found
No related tags found
No related merge requests found
......@@ -57,12 +57,20 @@ pub unsafe extern "C" fn opendir(path: *const c_char) -> *mut DIR {
#[no_mangle]
pub unsafe extern "C" fn closedir(dir: *mut DIR) -> c_int {
let mut dir = Box::from_raw(dir);
let ret = Sys::close(*dir.file);
let ret = {
let mut dir = Box::from_raw(dir);
// Reference files aren't closed when dropped
dir.file.reference = true;
let ret = Sys::close(*dir.file);
// Reference files aren't closed when dropped
dir.file.reference = true;
//TODO: find out why dropping dir can crash
mem::forget(dir);
ret
};
ret
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment