From 88bc10bac9f0f6497353a07c03c6ed789192affb Mon Sep 17 00:00:00 2001 From: libo429 Date: Mon, 25 Mar 2024 17:15:18 +0800 Subject: [PATCH] backup_tool crash Signed-off-by: libo429 --- tools/backup_tool/src/tools_op_incremental_restore.cpp | 4 +++- tools/backup_tool/src/tools_op_incremental_restore_async.cpp | 4 +++- tools/backup_tool/src/tools_op_restore.cpp | 4 +++- tools/backup_tool/src/tools_op_restore_async.cpp | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/backup_tool/src/tools_op_incremental_restore.cpp b/tools/backup_tool/src/tools_op_incremental_restore.cpp index ab635a44d..703a922ed 100644 --- a/tools/backup_tool/src/tools_op_incremental_restore.cpp +++ b/tools/backup_tool/src/tools_op_incremental_restore.cpp @@ -209,7 +209,9 @@ static void RestoreApp(shared_ptr restore) string path = string(BConstants::BACKUP_TOOL_INCREMENTAL_RECEIVE_DIR) + data.bundleName + "/" + to_string(data.lastIncrementalTime) + string(BConstants::BACKUP_TOOL_INCREMENTAL); if (access(path.data(), F_OK) != 0) { - throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); + HILOGE("bundleName tar does not exist, file %{public}s errno : %{public}d", + path.c_str(), errno); + continue; } const auto [err, filePaths] = BDir::GetDirFiles(path); if (err != 0) { diff --git a/tools/backup_tool/src/tools_op_incremental_restore_async.cpp b/tools/backup_tool/src/tools_op_incremental_restore_async.cpp index fe9628ac9..8b52144b8 100644 --- a/tools/backup_tool/src/tools_op_incremental_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_incremental_restore_async.cpp @@ -222,7 +222,9 @@ static void RestoreApp(shared_ptr restore, vector restore, vector &bundleNa } string path = string(BConstants::BACKUP_TOOL_RECEIVE_DIR) + bundleName; if (access(path.data(), F_OK) != 0) { - throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); + HILOGE("bundleName tar does not exist, file %{public}s errno : %{public}d", + path.c_str(), errno); + continue; } const auto [err, filePaths] = BDir::GetDirFiles(path); if (err != 0) { diff --git a/tools/backup_tool/src/tools_op_restore_async.cpp b/tools/backup_tool/src/tools_op_restore_async.cpp index 47ab6b8d4..0be93a066 100644 --- a/tools/backup_tool/src/tools_op_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_restore_async.cpp @@ -216,7 +216,9 @@ static void RestoreApp(shared_ptr restore, vector &bun } string path = string(BConstants::BACKUP_TOOL_RECEIVE_DIR) + bundleName; if (access(path.data(), F_OK) != 0) { - throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); + HILOGE("bundleName tar does not exist, file %{public}s errno : %{public}d", + path.c_str(), errno); + continue; } // update manage.json and fileName -- Gitee