From d80db2bdfe7bc9104e63ff36a7f673b5a86b1d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=99=9F=E9=92=B0?= Date: Wed, 21 Aug 2024 09:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmkdir=E6=97=B6=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E5=B7=B2=E5=AD=98=E5=9C=A8=E4=BC=9A=E8=B7=B3?= =?UTF-8?q?=E8=BF=87=20=EF=BC=88cherry=20picked=20commit=20from=20Signed-off-by:=20Zshengy?= =?UTF-8?q?u26=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_external/bms_adapter.cpp | 2 +- utils/src/b_json/b_json_service_disposal_config.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index 87b1cfda4..ca4486807 100644 --- a/services/backup_sa/src/module_external/bms_adapter.cpp +++ b/services/backup_sa/src/module_external/bms_adapter.cpp @@ -199,7 +199,7 @@ static bool CreateIPCInteractionFiles(int32_t userId, const string &bundleName, bundleName + BConstants::FILE_SEPARATOR_CHAR; if (access(backupSaBundleDir.data(), F_OK) != 0) { int32_t err = mkdir(backupSaBundleDir.data(), S_IRWXU | S_IRWXG); - if (err != 0) { + if (err != 0 && errno != EEXIST) { HILOGE("Failed to create folder in backup_sa bundleName:%{public}s, sys err:%{public}d", bundleName.c_str(), errno); return false; diff --git a/utils/src/b_json/b_json_service_disposal_config.cpp b/utils/src/b_json/b_json_service_disposal_config.cpp index ca94e2112..5ab1644b8 100644 --- a/utils/src/b_json/b_json_service_disposal_config.cpp +++ b/utils/src/b_json/b_json_service_disposal_config.cpp @@ -93,13 +93,13 @@ bool BJsonDisposalConfig::AppendIntoDisposalConfigFile(const string& bundleName) } cJSON *configArray = cJSON_GetObjectItem(jsonObjectDis, "DispoasalConfigFile"); - if (configArray == nullptr) { + if (configArray == nullptr || !cJSON_IsArray(configArray)) { HILOGE("parse json failed"); cJSON_Delete(jsonObjectDis); return false; } cJSON *newItem = cJSON_CreateObject(); - if (configArray == nullptr || newItem == nullptr) { + if (newItem == nullptr) { HILOGE("parse json failed"); cJSON_Delete(jsonObjectDis); return false; @@ -148,7 +148,7 @@ bool BJsonDisposalConfig::DeleteFromDisposalConfigFile(const string& bundleName) } cJSON *configArray = cJSON_GetObjectItem(jsonObjectDis, "DispoasalConfigFile"); - if (configArray == nullptr) { + if (configArray == nullptr || !cJSON_IsArray(configArray)) { cJSON_Delete(jsonObjectDis); return false; } @@ -202,7 +202,7 @@ bool BJsonDisposalConfig::IfBundleNameInDisposalConfigFile(const string& bundleN } cJSON *configArray = cJSON_GetObjectItem(jsonObjectDis, "DispoasalConfigFile"); - if (configArray == nullptr) { + if (configArray == nullptr || !cJSON_IsArray(configArray)) { HILOGE("parse json failed"); cJSON_Delete(jsonObjectDis); return false; @@ -246,7 +246,7 @@ vector BJsonDisposalConfig::GetBundleNameFromConfigFile() } cJSON *configArray = cJSON_GetObjectItem(jsonObjectDis, "DispoasalConfigFile"); - if (configArray == nullptr) { + if (configArray == nullptr || !cJSON_IsArray(configArray)) { HILOGE("parse json failed"); cJSON_Delete(jsonObjectDis); return {}; -- Gitee