Fix the invalid epoll_event pointer introduced by compilation optimization

That pointer does not point to the libc::epoll_event after release
build. Explicitly declaring the libc::epoll_event avoids the
invalidation.
This commit is contained in:
He Sun 2020-04-27 10:07:54 +08:00 committed by Tate, Hongliang Tian
parent 6a17e6292c
commit 48d7f8df3e

@ -108,12 +108,11 @@ impl EpollFile {
// we don't have to worry about the potential deadlock caused by // we don't have to worry about the potential deadlock caused by
// locking two files (say, fd and epfd) in an inconsistent order. // locking two files (say, fd and epfd) in an inconsistent order.
let raw_epevent_ptr: *mut libc::epoll_event = match event { //TODO: Shoud be const.
Some(epevent) => { // Cast const to mut to be compatiable with the ocall from rust sdk.
//TODO: Shoud be const. let mut epevent = event.map(|e| e.to_raw());
// Cast const to mut to be compatiable with the ocall from rust sdk. let raw_epevent_ptr: *mut libc::epoll_event = match epevent {
&mut epevent.to_raw() Some(ref mut e) => e as *mut _,
}
_ => std::ptr::null_mut(), _ => std::ptr::null_mut(),
}; };