Run cargo fmt

This commit is contained in:
topjohnwu
2025-09-02 11:11:49 -07:00
committed by John Wu
parent bd657c354c
commit bc89c60977
4 changed files with 29 additions and 22 deletions

View File

@@ -111,9 +111,10 @@ pub(crate) unsafe fn readlinkat(
unsafe extern "C" fn cp_afc_for_cxx(src: *const c_char, dest: *const c_char) -> bool {
unsafe {
if let Ok(src) = Utf8CStr::from_ptr(src)
&& let Ok(dest) = Utf8CStr::from_ptr(dest) {
return src.copy_to(dest).log_cxx().is_ok();
}
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.copy_to(dest).log_cxx().is_ok();
}
false
}
}
@@ -122,9 +123,10 @@ unsafe extern "C" fn cp_afc_for_cxx(src: *const c_char, dest: *const c_char) ->
unsafe extern "C" fn mv_path_for_cxx(src: *const c_char, dest: *const c_char) -> bool {
unsafe {
if let Ok(src) = Utf8CStr::from_ptr(src)
&& let Ok(dest) = Utf8CStr::from_ptr(dest) {
return src.move_to(dest).log_cxx().is_ok();
}
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.move_to(dest).log_cxx().is_ok();
}
false
}
}
@@ -133,9 +135,10 @@ unsafe extern "C" fn mv_path_for_cxx(src: *const c_char, dest: *const c_char) ->
unsafe extern "C" fn link_path_for_cxx(src: *const c_char, dest: *const c_char) -> bool {
unsafe {
if let Ok(src) = Utf8CStr::from_ptr(src)
&& let Ok(dest) = Utf8CStr::from_ptr(dest) {
return src.link_to(dest).log_cxx().is_ok();
}
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.link_to(dest).log_cxx().is_ok();
}
false
}
}
@@ -144,9 +147,10 @@ unsafe extern "C" fn link_path_for_cxx(src: *const c_char, dest: *const c_char)
unsafe extern "C" fn clone_attr_for_cxx(src: *const c_char, dest: *const c_char) -> bool {
unsafe {
if let Ok(src) = Utf8CStr::from_ptr(src)
&& let Ok(dest) = Utf8CStr::from_ptr(dest) {
return clone_attr(src, dest).log_cxx().is_ok();
}
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return clone_attr(src, dest).log_cxx().is_ok();
}
false
}
}

View File

@@ -211,10 +211,11 @@ fn dtb_test(file: &Utf8CStr) -> LoggedResult<bool> {
continue;
}
if let Some(mount_point) = child.property("mnt_point")
&& mount_point.value == b"/system_root\0" {
ret = false;
break;
}
&& mount_point.value == b"/system_root\0"
{
ret = false;
break;
}
}
}
Ok(())

View File

@@ -29,9 +29,10 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
if let Some(last_mount) = mounts
.range::<String, _>((Unbounded, Excluded(&info.target)))
.last()
&& info.target.starts_with(&format!("{}/", *last_mount)) {
continue;
}
&& info.target.starts_with(&format!("{}/", *last_mount))
{
continue;
}
let mut target = info.target.clone();
let target = Utf8CStr::from_string(&mut target);

View File

@@ -128,9 +128,10 @@ pub unsafe extern "C" fn main(
}
if let Some(file) = cli.save
&& !sepol.to_file(&file) {
log_err!("Cannot dump policy to {}", file)?;
}
&& !sepol.to_file(&file)
{
log_err!("Cannot dump policy to {}", file)?;
}
};
if res.is_ok() { 0 } else { 1 }
}