Skip to content

Commit 5278cb5

Browse files
dependabot[bot]stefano-garzarella
authored andcommitted
build(deps): update nix requirement from 0.26 to 0.27
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version. - [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md) - [Commits](nix-rust/nix@v0.26.0...v0.27.1) --- updated-dependencies: - dependency-name: nix dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> nix 0.27 required these changes: - memfd_create() is now only available with crate feature `fs`. - the return value of memfd_create() is now an OwnedFd and not RawFd anymore. We are using nix only for testing, so no functional changes at all. Signed-off-by: Stefano Garzarella <[email protected]>
1 parent 3808f9d commit 5278cb5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

crates/vhost-user-backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vm-memory = { version = "0.12.0", features = ["backend-mmap", "backend-atomic"]
2121
vmm-sys-util = "0.11.0"
2222

2323
[dev-dependencies]
24-
nix = "0.26"
24+
nix = { version = "0.27", features = ["fs"] }
2525
vhost = { path = "../vhost", version = "0.8", features = ["test-utils", "vhost-user-frontend", "vhost-user-backend"] }
2626
vm-memory = { version = "0.12.0", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
2727
tempfile = "3.2.0"

crates/vhost-user-backend/tests/vhost-user-server.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::ffi::CString;
22
use std::fs::File;
33
use std::io::Result;
4-
use std::os::unix::io::{AsRawFd, FromRawFd};
4+
use std::os::unix::io::AsRawFd;
55
use std::os::unix::net::UnixStream;
66
use std::path::Path;
77
use std::sync::{Arc, Barrier, Mutex};
@@ -153,8 +153,7 @@ fn vhost_user_client(path: &Path, barrier: Arc<Barrier>) {
153153
nix::sys::memfd::MemFdCreateFlag::empty(),
154154
)
155155
.unwrap();
156-
// SAFETY: Safe because we panic before if memfd is not valid.
157-
let file = unsafe { File::from_raw_fd(memfd) };
156+
let file = File::from(memfd);
158157
file.set_len(0x100000).unwrap();
159158
let file_offset = FileOffset::new(file, 0);
160159
let mem = GuestMemoryMmap::<()>::from_ranges_with_files(&[(

0 commit comments

Comments
 (0)