mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-29 22:14:27 +02:00
Address several clippy warnings
This commit is contained in:
parent
2b47d47215
commit
c6c1a17ae6
@ -95,7 +95,7 @@ fn hex2byte(hex: &[u8]) -> Vec<u8> {
|
||||
let low = bytes[1].to_ascii_uppercase() - b'0';
|
||||
let h = if high > 9 { high - 7 } else { high };
|
||||
let l = if low > 9 { low - 7 } else { low };
|
||||
v.push(h << 4 | l);
|
||||
v.push((h << 4) | l);
|
||||
}
|
||||
v
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use crate::su::db::RootSettings;
|
||||
use crate::UCred;
|
||||
use base::{debug, error, exit_on_error, libc, warn, LoggedResult, ResultExt, WriteExt};
|
||||
use std::fs::File;
|
||||
use std::os::fd::{AsRawFd, FromRawFd, IntoRawFd};
|
||||
use std::os::fd::{FromRawFd, IntoRawFd};
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
@ -113,15 +113,14 @@ impl AccessInfo {
|
||||
|
||||
impl MagiskD {
|
||||
pub fn su_daemon_handler(&self, client: i32, cred: &UCred) {
|
||||
let mut client = unsafe { UnixStream::from_raw_fd(client) };
|
||||
let cred = cred.0;
|
||||
debug!(
|
||||
"su: request from uid=[{}], pid=[{}], client=[{}]",
|
||||
cred.uid,
|
||||
cred.pid,
|
||||
client.as_raw_fd()
|
||||
cred.uid, cred.pid, client
|
||||
);
|
||||
|
||||
let mut client = unsafe { UnixStream::from_raw_fd(client) };
|
||||
|
||||
let mut req = match client.read_decodable::<SuRequest>().log() {
|
||||
Ok(req) => req,
|
||||
Err(_) => {
|
||||
|
@ -1,23 +1,33 @@
|
||||
use crate::ffi::{backup_init, BootConfig, MagiskInit};
|
||||
use base::{debug, path, BytesExt, MappedFile};
|
||||
use std::ffi::CStr;
|
||||
use base::{path, BytesExt, MappedFile};
|
||||
|
||||
impl BootConfig {
|
||||
#[allow(unused_imports, unused_unsafe)]
|
||||
pub(crate) fn print(&self) {
|
||||
use base::{debug, Utf8CStr};
|
||||
debug!("skip_initramfs=[{}]", self.skip_initramfs);
|
||||
debug!("force_normal_boot=[{}]", self.force_normal_boot);
|
||||
debug!("rootwait=[{}]", self.rootwait);
|
||||
unsafe {
|
||||
debug!("slot=[{:?}]", CStr::from_ptr(self.slot.as_ptr()));
|
||||
debug!("dt_dir=[{:?}]", CStr::from_ptr(self.dt_dir.as_ptr()));
|
||||
debug!(
|
||||
"fstab_suffix=[{:?}]",
|
||||
CStr::from_ptr(self.fstab_suffix.as_ptr())
|
||||
"slot=[{}]",
|
||||
Utf8CStr::from_ptr_unchecked(self.slot.as_ptr())
|
||||
);
|
||||
debug!("hardware=[{:?}]", CStr::from_ptr(self.hardware.as_ptr()));
|
||||
debug!(
|
||||
"hardware.platform=[{:?}]",
|
||||
CStr::from_ptr(self.hardware_plat.as_ptr())
|
||||
"dt_dir=[{}]",
|
||||
Utf8CStr::from_ptr_unchecked(self.dt_dir.as_ptr())
|
||||
);
|
||||
debug!(
|
||||
"fstab_suffix=[{}]",
|
||||
Utf8CStr::from_ptr_unchecked(self.fstab_suffix.as_ptr())
|
||||
);
|
||||
debug!(
|
||||
"hardware=[{}]",
|
||||
Utf8CStr::from_ptr_unchecked(self.hardware.as_ptr())
|
||||
);
|
||||
debug!(
|
||||
"hardware.platform=[{}]",
|
||||
Utf8CStr::from_ptr_unchecked(self.hardware_plat.as_ptr())
|
||||
);
|
||||
}
|
||||
debug!("emulator=[{}]", self.emulator);
|
||||
|
@ -81,6 +81,7 @@ impl MagiskInit {
|
||||
|
||||
// Redirect original init to magiskinit
|
||||
let v = map.patch(from.as_bytes(), to.as_bytes());
|
||||
#[allow(unused_variables)]
|
||||
for off in &v {
|
||||
debug!("Patch @ {:#010X} [{}] -> [{}]", off, from, to);
|
||||
}
|
||||
@ -100,6 +101,7 @@ impl MagiskInit {
|
||||
|
||||
// Redirect original init to magiskinit
|
||||
let v = map.patch(from.as_bytes(), to.as_bytes());
|
||||
#[allow(unused_variables)]
|
||||
for off in &v {
|
||||
debug!("Patch @ {:#010X} [{}] -> [{}]", off, from, to);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user