You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
ksud: fix clippy
This commit is contained in:
@@ -376,19 +376,14 @@ const CMD_TYPE_TRANSITION: u32 = 7;
|
|||||||
const CMD_TYPE_CHANGE: u32 = 8;
|
const CMD_TYPE_CHANGE: u32 = 8;
|
||||||
const CMD_GENFSCON: u32 = 9;
|
const CMD_GENFSCON: u32 = 9;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
enum PolicyObject {
|
enum PolicyObject {
|
||||||
All, // for "*", stand for all objects, and is NULL in ffi
|
All, // for "*", stand for all objects, and is NULL in ffi
|
||||||
One([u8; SEPOLICY_MAX_LEN]),
|
One([u8; SEPOLICY_MAX_LEN]),
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PolicyObject {
|
|
||||||
fn default() -> Self {
|
|
||||||
PolicyObject::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&str> for PolicyObject {
|
impl TryFrom<&str> for PolicyObject {
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
fn try_from(s: &str) -> Result<Self> {
|
fn try_from(s: &str) -> Result<Self> {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ pub fn get_zip_uncompressed_size(zip_path: &str) -> Result<u64> {
|
|||||||
pub fn switch_mnt_ns(pid: i32) -> Result<()> {
|
pub fn switch_mnt_ns(pid: i32) -> Result<()> {
|
||||||
use anyhow::ensure;
|
use anyhow::ensure;
|
||||||
use std::os::fd::AsRawFd;
|
use std::os::fd::AsRawFd;
|
||||||
let path = format!("/proc/{}/ns/mnt", pid);
|
let path = format!("/proc/{pid}/ns/mnt");
|
||||||
let fd = std::fs::File::open(path)?;
|
let fd = std::fs::File::open(path)?;
|
||||||
let ret = unsafe { libc::setns(fd.as_raw_fd(), libc::CLONE_NEWNS) };
|
let ret = unsafe { libc::setns(fd.as_raw_fd(), libc::CLONE_NEWNS) };
|
||||||
ensure!(ret == 0, "switch mnt ns failed");
|
ensure!(ret == 0, "switch mnt ns failed");
|
||||||
|
|||||||
Reference in New Issue
Block a user