From 191e852d281f8c1c95be70742b985acd8c9d77fe Mon Sep 17 00:00:00 2001 From: zhaoshuyuan Date: Wed, 20 Nov 2024 23:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E6=A1=86=E6=9E=B6=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=8F=8C=E6=A1=86=E6=9E=B6=E5=AE=89=E5=85=A8=E5=8A=A0=E5=9B=BA?= =?UTF-8?q?=E5=8A=A0log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaoshuyuan --- services/storage_daemon/crypto/src/base_key.cpp | 2 +- services/storage_daemon/ipc/src/storage_daemon.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/storage_daemon/crypto/src/base_key.cpp b/services/storage_daemon/crypto/src/base_key.cpp index 20aabf95..db673f18 100644 --- a/services/storage_daemon/crypto/src/base_key.cpp +++ b/services/storage_daemon/crypto/src/base_key.cpp @@ -696,7 +696,7 @@ bool BaseKey::DoRestoreKey(const UserAuth &auth, const std::string &path) std::string need_restore; LoadStringFromFile(path + SUFFIX_NEED_RESTORE, need_restore); uint32_t restore_version = std::atoi(need_restore.c_str()); - UpdateVersion update_version = static_cast(std::atoi(need_restore.c_str()) + 1); + UpdateVersion update_version = static_cast(std::atoi(need_restore.c_str())); LOGI("NeedRestore Path is: %{public}s, restore_version: %{public}u", path.c_str(), restore_version); if (std::filesystem::exists(path + SUFFIX_NEED_RESTORE, errCode)) { if (restore_version < 3) { diff --git a/services/storage_daemon/ipc/src/storage_daemon.cpp b/services/storage_daemon/ipc/src/storage_daemon.cpp index 2f747769..ff88b9a7 100644 --- a/services/storage_daemon/ipc/src/storage_daemon.cpp +++ b/services/storage_daemon/ipc/src/storage_daemon.cpp @@ -254,11 +254,13 @@ int32_t StorageDaemon::RestoreOneUserKey(int32_t userId, KeyType type) std::string elNeedRestorePath = GetNeedRestoreFilePathByType(userId, type); if (elNeedRestorePath.empty()) { + LOGI("elNeedRestorePath is empty, type = %{public}d", type); return E_KEY_TYPE_INVAL; } std::error_code errCode; if (!std::filesystem::exists(elNeedRestorePath, errCode)) { + LOGI("elNeedRestorePath not exist, type = %{public}d", type); return E_OK; } std::string SINGLE_RESTORE_VERSION;