Skip to content

Commit 723ad8c

Browse files
committed
install: Use rustix instead of nix in one place
Was looking at cleaning up the blockdev stuff a bit more; the unsafe nix ioctl code we have is a bit of a wart. Some searching turns up this use of nix, but rustix exposes what we want here. (rustix and nix heavily overlap, I think rustix is a bit better designed, though nix has been doing some breaking changes to catch up) Signed-off-by: Colin Walters <[email protected]>
1 parent 298a336 commit 723ad8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/src/install.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,11 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
774774
.ok_or_else(|| anyhow::anyhow!("Missing command"))?;
775775
tracing::trace!("{cmd:?} {args:?}");
776776
let pid1mountns = std::fs::File::open("/proc/1/ns/mnt").context("open pid1 mountns")?;
777-
nix::sched::setns(pid1mountns.as_fd(), nix::sched::CloneFlags::CLONE_NEWNS).context("setns")?;
777+
rustix::thread::move_into_link_name_space(
778+
pid1mountns.as_fd(),
779+
Some(rustix::thread::LinkNameSpaceType::Mount),
780+
)
781+
.context("setns")?;
778782
rustix::process::chdir("/").context("chdir")?;
779783
// Work around supermin doing chroot() and not pivot_root
780784
// https://github.com/libguestfs/supermin/blob/5230e2c3cd07e82bd6431e871e239f7056bf25ad/init/init.c#L288

0 commit comments

Comments
 (0)