diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index a4d5669f8f47f2c08d76a9b94eb63b527926ada0..f41dc7fa7f172a73f4f176539193cc0fadb0b02c 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -5880,6 +5880,11 @@ ErrCode BaseBundleInstaller::CopyHapsToSecurityDir(const InstallParam &installPa } auto destination = BundleUtil::CopyFileToSecurityDir(bundlePaths[index], DirType::STREAM_INSTALL_DIR, toDeleteTempHapPath_, installParam.IsRenameInstall()); + if (destination.empty() && installParam.IsRenameInstall() && errno == EXDEV) { + LOG_W(BMS_TAG_INSTALLER, "rename hap failed, try to copy instead"); + destination = BundleUtil::CopyFileToSecurityDir(bundlePaths[index], DirType::STREAM_INSTALL_DIR, + toDeleteTempHapPath_, false); + } if (destination.empty()) { LOG_E(BMS_TAG_INSTALLER, "copy file %{private}s to security dir failed", bundlePaths[index].c_str()); return ERR_APPEXECFWK_INSTALL_COPY_HAP_FAILED;