ksud: copy when rename failed

This commit is contained in:
tiann
2023-02-02 17:42:24 +08:00
parent 86998a032e
commit dc902b16d4
2 changed files with 3 additions and 1 deletions

View File

@@ -531,6 +531,8 @@ fn do_install_module(zip: String) -> Result<()> {
// all done, rename the tmp image to modules_update.img
if std::fs::rename(tmp_module_img, defs::MODULE_UPDATE_IMG).is_err() {
std::fs::copy(tmp_module_img, defs::MODULE_UPDATE_IMG)
.with_context(|| "Failed to copy image.".to_string())?;
let _ = std::fs::remove_file(tmp_module_img);
}

View File

@@ -125,7 +125,7 @@ pub fn mount_overlay(lowerdir: &str, mnt: &str) -> Result<()> {
}
#[cfg(not(target_os = "android"))]
pub fn mount_ext4(_src: &str, _target: &str, autodrop: bool) -> Result<()> {
pub fn mount_ext4(_src: &str, _target: &str, _autodrop: bool) -> Result<()> {
unimplemented!()
}