| 1 |
--- rust-calloop-0.10-0.10.6.orig/Cargo.toml |
| 2 |
+++ rust-calloop-0.10-0.10.6/Cargo.toml |
| 3 |
@@ -56,7 +56,7 @@ default-features = false |
| 4 |
version = "0.4" |
| 5 |
|
| 6 |
[dependencies.nix] |
| 7 |
-version = "0.29" |
| 8 |
+version = "0.30" |
| 9 |
features = [ |
| 10 |
"event", |
| 11 |
"fs", |
| 12 |
--- rust-calloop-0.10-0.10.6.orig/src/io.rs |
| 13 |
+++ rust-calloop-0.10-0.10.6/src/io.rs |
| 14 |
@@ -8,6 +8,7 @@ |
| 15 |
|
| 16 |
use std::cell::RefCell; |
| 17 |
use std::os::unix::io::{AsRawFd, RawFd}; |
| 18 |
+use std::os::fd::BorrowedFd; |
| 19 |
use std::pin::Pin; |
| 20 |
use std::rc::Rc; |
| 21 |
use std::task::{Context, Poll as TaskPoll, Waker}; |
| 22 |
@@ -49,9 +50,9 @@ impl<'l, F: AsRawFd> Async<'l, F> { |
| 23 |
pub(crate) fn new<Data>(inner: Rc<LoopInner<'l, Data>>, fd: F) -> crate::Result<Async<'l, F>> { |
| 24 |
let rawfd = fd.as_raw_fd(); |
| 25 |
// set non-blocking |
| 26 |
- let old_flags = fcntl(rawfd, FcntlArg::F_GETFL)?; |
| 27 |
+ let old_flags = fcntl(unsafe { BorrowedFd::borrow_raw(rawfd) }, FcntlArg::F_GETFL)?; |
| 28 |
let old_flags = unsafe { OFlag::from_bits_retain(old_flags) }; |
| 29 |
- fcntl(rawfd, FcntlArg::F_SETFL(old_flags | OFlag::O_NONBLOCK))?; |
| 30 |
+ fcntl(unsafe { BorrowedFd::borrow_raw(rawfd) }, FcntlArg::F_SETFL(old_flags | OFlag::O_NONBLOCK))?; |
| 31 |
// register in the loop |
| 32 |
let dispatcher = Rc::new(RefCell::new(IoDispatcher { |
| 33 |
fd: rawfd, |
| 34 |
@@ -157,7 +158,7 @@ impl<'l, F: AsRawFd> Drop for Async<'l, |
| 35 |
self.inner.kill(&self.dispatcher); |
| 36 |
// restore flags |
| 37 |
let _ = fcntl( |
| 38 |
- self.dispatcher.borrow().fd, |
| 39 |
+ unsafe { BorrowedFd::borrow_raw(self.dispatcher.borrow().fd) }, |
| 40 |
FcntlArg::F_SETFL(self.old_flags), |
| 41 |
); |
| 42 |
} |
| 43 |
--- rust-calloop-0.10-0.10.6.orig/src/sources/ping/eventfd.rs |
| 44 |
+++ rust-calloop-0.10-0.10.6/src/sources/ping/eventfd.rs |
| 45 |
@@ -84,7 +84,7 @@ fn drain_ping(fd: RawFd) -> std::io::Res |
| 46 |
const NBYTES: usize = 8; |
| 47 |
let mut buf = [0u8; NBYTES]; |
| 48 |
|
| 49 |
- match read(fd, &mut buf) { |
| 50 |
+ match read(unsafe { BorrowedFd::borrow_raw(fd) }, &mut buf) { |
| 51 |
// Reading from an eventfd should only ever produce 8 bytes. No looping |
| 52 |
// is required. |
| 53 |
Ok(NBYTES) => Ok(u64::from_ne_bytes(buf)), |