Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e2565e8 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi Committed by Gerrit Code Review
Browse files

Merge "floss: Use into_raw_fd to convert unixstream"

parents 1f250b2c 3b474307
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -366,7 +366,11 @@ impl InternalConnectingSocket {
// an open and valid file to operate on, converting to file via RawFd is just
// an open and valid file to operate on, converting to file via RawFd is just
// boilerplate.
// boilerplate.
fn unixstream_to_file(stream: UnixStream) -> std::fs::File {
fn unixstream_to_file(stream: UnixStream) -> std::fs::File {
    unsafe { std::fs::File::from_raw_fd(stream.as_raw_fd()) }
    unsafe {
        std::fs::File::from_raw_fd(
            stream.into_std().expect("Failed to convert tokio unixstream").into_raw_fd(),
        )
    }
}
}


// This is a safe operation in an unsafe wrapper. A file is already open and owned
// This is a safe operation in an unsafe wrapper. A file is already open and owned