feat: Optimize some codes (ksud) (#465)

* chore: make cargo clippy happy

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* chore: Optimize import
-  Format as a standard import

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

---------

Signed-off-by: Tools-app <localhost.hutao@gmail.com>
This commit is contained in:
生于生时 亡于亡刻
2025-10-12 15:48:24 +08:00
committed by GitHub
parent 4c512dc7ff
commit 0a804ba170
15 changed files with 232 additions and 221 deletions

View File

@@ -1,22 +1,20 @@
use anyhow::{Ok, Result};
use getopts::Options;
use std::env;
#[cfg(unix)]
use std::os::unix::process::CommandExt;
use std::path::PathBuf;
use std::{ffi::CStr, process::Command};
use crate::{
defs,
utils::{self, umask},
};
use std::{env, ffi::CStr, path::PathBuf, process::Command};
use anyhow::{Ok, Result};
use getopts::Options;
#[cfg(any(target_os = "linux", target_os = "android"))]
use rustix::{
process::getuid,
thread::{Gid, Uid, set_thread_res_gid, set_thread_res_uid},
};
use crate::{
defs,
utils::{self, umask},
};
#[cfg(any(target_os = "linux", target_os = "android"))]
pub fn grant_root(global_mnt: bool) -> Result<()> {
rustix::process::ksu_grant_root()?;