1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -81,7 +81,7 @@
optional = true
[dependencies.rustix]
-version = "0.38"
+version = "1"
features = [
"std",
"event",
--- a/src/rust_connection/stream.rs
+++ b/src/rust_connection/stream.rs
@@ -1,5 +1,6 @@
use rustix::fd::{AsFd, BorrowedFd};
use std::io::{IoSlice, Result};
+use std::mem::MaybeUninit;
use std::net::TcpStream;
#[cfg(unix)]
use std::os::unix::io::{AsRawFd, IntoRawFd, OwnedFd, RawFd};
@@ -316,7 +317,7 @@
let fds = fds.iter().map(|fd| fd.as_fd()).collect::<Vec<_>>();
let rights = SendAncillaryMessage::ScmRights(&fds);
- let mut cmsg_space = vec![0u8; rights.size()];
+ let mut cmsg_space = vec![MaybeUninit::uninit(); rights.size()];
let mut cmsg_buffer = SendAncillaryBuffer::new(&mut cmsg_space);
assert!(cmsg_buffer.push(rights));
@@ -346,7 +347,7 @@
let fd = self.as_fd();
let mut poll_fds = [PollFd::from_borrowed_fd(fd, poll_flags)];
loop {
- match poll(&mut poll_fds, -1) {
+ match poll(&mut poll_fds, None) {
Ok(_) => break,
Err(Errno::INTR) => {}
Err(e) => return Err(e.into()),
@@ -366,7 +367,7 @@
// 1024 bytes on the stack should be enough for more file descriptors than the X server will ever
// send, as well as the header for the ancillary data. If you can find a case where this can
// overflow with an actual production X11 server, I'll buy you a steak dinner.
- let mut cmsg = [0u8; 1024];
+ let mut cmsg = [MaybeUninit::uninit(); 1024];
let mut iov = [IoSliceMut::new(buf)];
let mut cmsg_buffer = RecvAncillaryBuffer::new(&mut cmsg);
@@ -464,7 +465,7 @@
) -> std::result::Result<RawFdContainer, rustix::io::Errno> {
use rustix::fs::{fcntl_getfl, fcntl_setfl, OFlags};
use rustix::net::{
- connect_unix, socket_with, AddressFamily, SocketAddrUnix, SocketFlags, SocketType,
+ connect, socket_with, AddressFamily, SocketAddrUnix, SocketFlags, SocketType,
};
let socket = socket_with(
@@ -474,7 +475,7 @@
None,
)?;
- connect_unix(&socket, &SocketAddrUnix::new_abstract_name(path)?)?;
+ connect(&socket, &SocketAddrUnix::new_abstract_name(path)?)?;
// Make the FD non-blocking
fcntl_setfl(&socket, fcntl_getfl(&socket)? | OFlags::NONBLOCK)?;
|