Skip to content

Commit

Permalink
fs: fix File::from_raw_fd test (#5528)
Browse files Browse the repository at this point in the history
  • Loading branch information
satakuma committed Mar 4, 2023
1 parent bd4ce68 commit ff2f286
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tokio/tests/fs_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,13 @@ async fn unix_fd_is_valid() {
#[tokio::test]
#[cfg(unix)]
async fn read_file_from_unix_fd() {
use std::os::unix::io::AsRawFd;
use std::os::unix::io::FromRawFd;
use std::os::unix::io::{FromRawFd, IntoRawFd};

let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();

let file1 = File::open(tempfile.path()).await.unwrap();
let raw_fd = file1.as_raw_fd();
let raw_fd = file1.into_std().await.into_raw_fd();
assert!(raw_fd > 0);

let mut file2 = unsafe { File::from_raw_fd(raw_fd) };
Expand Down

0 comments on commit ff2f286

Please sign in to comment.