From b3e3a5fdd73c75f69ef65cbca9b98f6bbe1b1e29 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 7 Dec 2022 16:03:08 +0000 Subject: [PATCH] vmm: Fix clippy on musl toolchains The datatype used for the ioctl() C library call is different between it and the glibc toolchains. The easiest solution is to have the compiler type cast to type of the parameter. Signed-off-by: Rob Bradford --- vmm/src/device_manager.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index ce7085978..0f0d927b8 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -62,7 +62,6 @@ use pci::{ use seccompiler::SeccompAction; use serde::{Deserialize, Serialize}; use std::collections::{BTreeSet, HashMap}; -use std::convert::TryInto; use std::fs::{read_link, File, OpenOptions}; use std::io::{self, stdout, Seek, SeekFrom}; use std::mem::zeroed; @@ -504,19 +503,13 @@ pub fn create_pty() -> io::Result<(File, File, PathBuf)> { }; let mut unlock: libc::c_ulong = 0; // SAFETY: FFI call into libc, trivially safe - unsafe { - libc::ioctl( - main.as_raw_fd(), - TIOCSPTLCK.try_into().unwrap(), - &mut unlock, - ) - }; + unsafe { libc::ioctl(main.as_raw_fd(), TIOCSPTLCK as _, &mut unlock) }; // SAFETY: FFI call into libc, trivally safe let sub_fd = unsafe { libc::ioctl( main.as_raw_fd(), - TIOCGTPEER.try_into().unwrap(), + TIOCGTPEER as _, libc::O_NOCTTY | libc::O_RDWR, ) };