From 412d10809d8b97ac4c7c2e3da8efc2e90915e228 Mon Sep 17 00:00:00 2001 From: huaqingsimeng <1004904143@qq.com> Date: Wed, 24 May 2023 11:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=AF=BC=E8=87=B4=E6=81=A2=E5=A4=8D=E6=97=B6?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=BA=94=E7=94=A8=E5=A4=B1=E8=B4=A5=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- services/backup_sa/src/module_sched/sched_scheduler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/backup_sa/src/module_sched/sched_scheduler.cpp b/services/backup_sa/src/module_sched/sched_scheduler.cpp index 18d5e6493..89e3d427b 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")); } -- Gitee