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,7 +111,8 @@ 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) {
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.copy_to(dest).log_cxx().is_ok();
}
false
@@ -122,7 +123,8 @@ 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) {
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.move_to(dest).log_cxx().is_ok();
}
false
@@ -133,7 +135,8 @@ 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) {
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return src.link_to(dest).log_cxx().is_ok();
}
false
@@ -144,7 +147,8 @@ 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) {
&& let Ok(dest) = Utf8CStr::from_ptr(dest)
{
return clone_attr(src, dest).log_cxx().is_ok();
}
false

View File

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

View File

@@ -29,7 +29,8 @@ 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)) {
&& info.target.starts_with(&format!("{}/", *last_mount))
{
continue;
}

View File

@@ -128,7 +128,8 @@ pub unsafe extern "C" fn main(
}
if let Some(file) = cli.save
&& !sepol.to_file(&file) {
&& !sepol.to_file(&file)
{
log_err!("Cannot dump policy to {}", file)?;
}
};