ksud: Fix clippy
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user