diff --git a/services/backup_sa/src/module_sched/sched_scheduler.cpp b/services/backup_sa/src/module_sched/sched_scheduler.cpp index 18d5e6493a41bd881431127925d73709ef0ca057..89e3d427b70b21d6ddcec4dabd646b5452260862 100644 --- a/services/backup_sa/src/module_sched/sched_scheduler.cpp +++ b/services/backup_sa/src/module_sched/sched_scheduler.cpp @@ -141,18 +141,20 @@ void SchedScheduler::InstallingState(const string &bundleName) string state = sessionPtr_->GetInstallState(bundleName); string path = string(BConstants::SA_BUNDLE_BACKUP_ROOT_DIR).append(bundleName); string filePath = path + "/bundle.hap"; - if (!GetRealPath(filePath)) { - throw BError(BError::Codes::SA_INVAL_ARG, string("File path is invalid")); - } if (state == BConstants::RESTORE_INSTALL_PATH) { if (!ForceCreateDirectory(path)) { throw BError(BError::Codes::SA_INVAL_ARG, string("Failed to create directory")); } + auto ret = GetRealPath(filePath); + HILOGE("ret = %{public}d", ret); sessionPtr_->GetServiceReverseProxy()->RestoreOnFileReady( bundleName, state, UniqueFd(open(filePath.data(), O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IROTH))); } else if (state == "OK") { + if (!GetRealPath(filePath)) { + throw BError(BError::Codes::SA_INVAL_ARG, string("File path is invalid")); + } if (access(filePath.data(), F_OK) != 0) { throw BError(BError::Codes::SA_INVAL_ARG, string("File already exists")); }