From af1a349bd5df1faa0daf167ee2c78b365b6467aa Mon Sep 17 00:00:00 2001 From: yang-jingbo1985 Date: Tue, 5 Dec 2023 22:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=A7=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=E4=B8=BA640?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yang-jingbo1985 --- utils/src/b_json/b_json_entity_ext_manage.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/src/b_json/b_json_entity_ext_manage.cpp b/utils/src/b_json/b_json_entity_ext_manage.cpp index 56b4749f0..c136a9358 100644 --- a/utils/src/b_json/b_json_entity_ext_manage.cpp +++ b/utils/src/b_json/b_json_entity_ext_manage.cpp @@ -27,6 +27,9 @@ namespace OHOS::FileManagement::Backup { using namespace std; +namespace { + const int32_t DEFAULT_MODE = 0100660; //0660 +} static bool CheckBigFile(const string &tarFile) { @@ -49,21 +52,18 @@ static bool CheckUserTar(const string &fileName) HILOGI("file does not exists"); return false; } - return (ExtractFileExt(fileName) == "tar") && CheckBigFile(fileName); } Json::Value Stat2JsonValue(struct stat sta) { Json::Value value; - value["st_size"] = static_cast(sta.st_size); value["st_mode"] = static_cast(sta.st_mode); value["st_atim"]["tv_sec"] = static_cast(sta.st_atim.tv_sec); value["st_atim"]["tv_nsec"] = static_cast(sta.st_atim.tv_nsec); value["st_mtim"]["tv_sec"] = static_cast(sta.st_mtim.tv_sec); value["st_mtim"]["tv_nsec"] = static_cast(sta.st_mtim.tv_nsec); - return value; } @@ -76,7 +76,7 @@ struct stat JsonValue2Stat(const Json::Value &value) } sta.st_size = value.isMember("st_size") && value["st_size"].isInt64() ? value["st_size"].asInt64() : 0; - sta.st_mode = value.isMember("st_mode") && value["st_mode"].isInt() ? value["st_mode"].asInt() : 0; + sta.st_mode = value.isMember("st_mode") && value["st_mode"].isInt() ? value["st_mode"].asInt() : DEFAULT_MODE; if (value.isMember("st_atim")) { sta.st_atim.tv_sec = value["st_atim"].isMember("tv_sec") && value["st_atim"]["tv_sec"].isInt64() ? value["st_atim"]["tv_sec"].asInt64() -- Gitee