ksud: make compiler happy

This commit is contained in:
tiann
2023-04-11 20:45:21 +08:00
parent 719b90f8da
commit e70a95f1ec

View File

@@ -247,6 +247,7 @@ pub struct StockMount {
mnt: String, mnt: String,
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
mountlist: Vec<(proc_mounts::MountInfo, std::path::PathBuf)>, mountlist: Vec<(proc_mounts::MountInfo, std::path::PathBuf)>,
#[cfg(any(target_os = "linux", target_os = "android"))]
rootmount: sys_mount::Mount, rootmount: sys_mount::Mount,
} }
@@ -261,11 +262,11 @@ impl StockMount {
mounts.sort_by(|a, b| b.dest.cmp(&a.dest)); // inverse order mounts.sort_by(|a, b| b.dest.cmp(&a.dest)); // inverse order
let mntroot = std::path::Path::new(crate::defs::STOCK_MNT_ROOT); let mntroot = std::path::Path::new(crate::defs::STOCK_MNT_ROOT);
utils::ensure_dir_exists(&mntroot)?; utils::ensure_dir_exists(mntroot)?;
log::info!("stock mount root: {}", mntroot.display()); log::info!("stock mount root: {}", mntroot.display());
let rootdir = mntroot.join( let rootdir = mntroot.join(
mnt.strip_prefix("/") mnt.strip_prefix('/')
.ok_or(anyhow::anyhow!("invalid mnt: {}!", mnt))?, .ok_or(anyhow::anyhow!("invalid mnt: {}!", mnt))?,
); );
utils::ensure_dir_exists(&rootdir)?; utils::ensure_dir_exists(&rootdir)?;
@@ -290,7 +291,7 @@ impl StockMount {
log::info!("bind stock mount: {} -> {}", dest.display(), path.display()); log::info!("bind stock mount: {} -> {}", dest.display(), path.display());
Mount::builder() Mount::builder()
.flags(MountFlags::BIND) .flags(MountFlags::BIND)
.mount(&dest, &path)?; .mount(dest, &path)?;
ms.push((m.clone(), path)); ms.push((m.clone(), path));
} }
@@ -315,7 +316,7 @@ impl StockMount {
.mount(&src, &dst); .mount(&src, &dst);
if let Err(e) = mount_result { if let Err(e) = mount_result {
log::error!("remount failed: {}", e); log::error!("remount failed: {}", e);
result = Err(e); result = Err(e.into());
} else { } else {
log::info!( log::info!(
"remount {}({}) -> {} succeed!", "remount {}({}) -> {} succeed!",