ksud: fix potential slow copy

This commit is contained in:
weishu
2024-01-30 22:34:33 +08:00
parent 7cb5fb47e1
commit 27bd18f60e

View File

@@ -246,7 +246,7 @@ pub fn on_boot_completed() -> Result<()> {
// this is a update and we successfully booted
if std::fs::rename(module_update_img, module_img).is_err() {
warn!("Failed to rename images, copy it now.",);
std::fs::copy(module_update_img, module_img)
utils::copy_sparse_file(module_update_img, module_img)
.with_context(|| "Failed to copy images")?;
std::fs::remove_file(module_update_img).with_context(|| "Failed to remove image!")?;
}