Skip to content

Commit 65af48c

Browse files
authored
Merge pull request #1242 from cgwalters/bump-rustix
Update to rustix 1.0
2 parents 61c7ee4 + 8d97ddd commit 65af48c

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

Cargo.lock

Lines changed: 44 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ indicatif = "0.17.0"
5454
fn-error-context = "0.2.1"
5555
libc = "0.2.154"
5656
openssl = "0.10.33"
57-
rustix = { "version" = "0.38.34", features = ["thread", "fs", "system", "process", "mount"] }
57+
rustix = { "version" = "1", features = ["thread", "net", "fs", "system", "process", "mount"] }
5858
serde = "1.0.199"
5959
serde_json = "1.0.116"
6060
similar-asserts = "1.5.0"

lib/src/mount.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::{
44
fs,
5+
mem::MaybeUninit,
56
os::fd::{AsFd, OwnedFd},
67
process::Command,
78
};
@@ -199,7 +200,7 @@ pub(crate) fn open_tree_from_pidns(
199200
// And send that file descriptor via fd passing over the socketpair.
200201
let fd = fd.as_fd();
201202
let fds = [fd];
202-
let mut buffer = [0u8; rustix::cmsg_space!(ScmRights(1))];
203+
let mut buffer = [MaybeUninit::uninit(); rustix::cmsg_space!(ScmRights(1))];
203204
let mut control = SendAncillaryBuffer::new(&mut buffer);
204205
let pushed = control.push(SendAncillaryMessage::ScmRights(&fds));
205206
assert!(pushed);
@@ -218,7 +219,7 @@ pub(crate) fn open_tree_from_pidns(
218219
let pid = rustix::process::Pid::from_raw(n).unwrap();
219220
drop(sock_child);
220221
// Receive the mount file descriptor from the child
221-
let mut cmsg_space = vec![0; rustix::cmsg_space!(ScmRights(1))];
222+
let mut cmsg_space = vec![MaybeUninit::uninit(); rustix::cmsg_space!(ScmRights(1))];
222223
let mut cmsg_buffer = rustix::net::RecvAncillaryBuffer::new(&mut cmsg_space);
223224
let mut buf = [0u8; DUMMY_DATA.len()];
224225
let iov = std::io::IoSliceMut::new(buf.as_mut());
@@ -244,8 +245,9 @@ pub(crate) fn open_tree_from_pidns(
244245
.next()
245246
.ok_or_else(|| anyhow::anyhow!("Did not receive a file descriptor"))?;
246247
// SAFETY: Since we're not setting WNOHANG, this will always return Some().
247-
let st =
248-
rustix::process::waitpid(Some(pid), WaitOptions::empty())?.expect("Wait status");
248+
let st = rustix::process::waitpid(Some(pid), WaitOptions::empty())?
249+
.expect("Wait status")
250+
.1;
249251
if let Some(0) = st.exit_status() {
250252
Ok(r)
251253
} else {

system-reinstall-bootc/src/users.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ fn get_keys_from_files(user: &uzers::User, keyfiles: &Vec<&str>) -> Result<Vec<P
155155
}
156156

157157
// Safety: The UID should be valid because we got it from uzers
158-
#[allow(unsafe_code)]
159-
let user_uid = unsafe { Uid::from_raw(user.uid()) };
158+
let user_uid = Uid::from_raw(user.uid());
160159

161160
// Change the effective uid for this scope, to avoid accidentally reading files we
162161
// shouldn't through symlinks

utils/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl CommandRunExt for Command {
101101
unsafe {
102102
self.pre_exec(|| {
103103
rustix::process::set_parent_process_death_signal(Some(
104-
rustix::process::Signal::Term,
104+
rustix::process::Signal::TERM,
105105
))
106106
.map_err(Into::into)
107107
})

0 commit comments

Comments
 (0)