ksud: Fix clippy

This commit is contained in:
ShirkNeko
2025-11-07 00:11:02 +08:00
parent 826661dffb
commit 02f1aec6e9
2 changed files with 2 additions and 5 deletions

View File

@@ -1,5 +1,4 @@
use std::fs; use std::fs;
use std::os::fd::OwnedFd;
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::fd::RawFd; use std::os::fd::RawFd;
use std::sync::OnceLock; use std::sync::OnceLock;

View File

@@ -6,8 +6,6 @@ use anyhow::{Context, Ok, Result, bail};
use getopts::Options; use getopts::Options;
use libc::c_int; use libc::c_int;
use log::{debug, error, info}; use log::{debug, error, info};
use procfs::process::FDTarget::Path;
use std::fs::File;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::process::CommandExt; use std::os::unix::process::CommandExt;
use std::{env, ffi::CStr, path::PathBuf, process::Command}; use std::{env, ffi::CStr, path::PathBuf, process::Command};
@@ -68,7 +66,7 @@ fn set_identity(uid: u32, gid: u32, groups: &[u32]) {
} }
} }
#[cfg(any(target_os = "android"))] #[cfg(target_os = "android")]
fn wrap_tty(fd: c_int) { fn wrap_tty(fd: c_int) {
let inner_fn = move || -> Result<()> { let inner_fn = move || -> Result<()> {
if unsafe { libc::isatty(fd) != 1 } { if unsafe { libc::isatty(fd) != 1 } {
@@ -299,7 +297,7 @@ pub fn root_shell() -> Result<()> {
let _ = utils::switch_mnt_ns(1); let _ = utils::switch_mnt_ns(1);
} }
#[cfg(any(target_os = "android"))] #[cfg(target_os = "android")]
if use_fd_wrapper { if use_fd_wrapper {
wrap_tty(0); wrap_tty(0);
wrap_tty(1); wrap_tty(1);