/base/security/code_signature/test/unittest/ |
D | enable_verity_test.cpp | 185 static void CleanFile(const std::string &filePath) in CleanFile() argument 187 EXPECT_EQ(OHOS::RemoveFile(filePath), true); in CleanFile() 220 static void CheckEnableSuccess(const std::string &filePath) in CheckEnableSuccess() argument 224 FILE *fout = fopen(filePath.c_str(), "wb"); in CheckEnableSuccess() 228 EXPECT_EQ(ReadDataFromFile(filePath, tmp), true); in CheckEnableSuccess() 237 static bool TamperFileTail(const std::string &filePath) in TamperFileTail() argument 239 FILE *file = fopen(filePath.c_str(), "ab"); in TamperFileTail() 259 static bool TamperFileHead(const std::string &filePath) in TamperFileHead() argument 261 FILE *file = fopen(filePath.c_str(), "ab"); in TamperFileHead() 276 int32_t EnableVerityOnOneFile(const std::string filePath, in EnableVerityOnOneFile() argument [all …]
|
/base/update/updater/test/fuzztest/applypatch_fuzzer/ |
D | applypatch_fuzzer.cpp | 29 const std::string filePath = "/data/fuzz/test/MountForPath_fuzzer.fstable"; in FuzzApplyPatch() local 30 ApplyPatch(filePath, filePath, std::string(reinterpret_cast<const char*>(data), size)); in FuzzApplyPatch() 31 ApplyPatch(filePath, std::string(reinterpret_cast<const char*>(data), size), filePath); in FuzzApplyPatch() 32 ApplyPatch(std::string(reinterpret_cast<const char*>(data), size), filePath, filePath); in FuzzApplyPatch()
|
/base/hiviewdfx/hiview/framework/native/unified_collection/calculator/ |
D | io_calculator.cpp | 33 std::string filePath = path + "/size"; in GetEMMCSize() local 34 if (FileUtil::FileExists(filePath)) { in GetEMMCSize() 35 sizeStr = FileUtil::GetFirstLine(filePath); in GetEMMCSize() 38 filePath = path + "/block/mmcblk" + std::to_string(index) + "/size"; in GetEMMCSize() 39 if (FileUtil::FileExists(filePath)) { in GetEMMCSize() 40 sizeStr = FileUtil::GetFirstLine(filePath); in GetEMMCSize() 49 HIVIEW_LOGE("load file=%{public}s failed.", filePath.c_str()); in GetEMMCSize() 56 std::string filePath = path + "/manfid"; in GetEMMCManfid() local 57 std::string eMMCManfid = FileUtil::GetFirstLine(filePath); in GetEMMCManfid() 59 HIVIEW_LOGE("load file=%{public}s failed.", filePath.c_str()); in GetEMMCManfid()
|
/base/security/huks/test/unittest/huks_common_test/src/ |
D | hks_test_file_operator_func.c | 60 char filePath[PATH_MAX + 1] = {0}; in FileRead() local 61 (void)realpath(fileName, filePath); in FileRead() 62 if (strstr(filePath, "../") != NULL) { in FileRead() 63 HKS_TEST_LOG_E("invalid filePath, path %s", filePath); in FileRead() 67 FILE *fp = fopen(filePath, "rb"); in FileRead() 105 char filePath[PATH_MAX + 1] = {0}; in FileWrite() local 106 if (memcpy_s(filePath, sizeof(filePath) - 1, fileName, strlen(fileName)) != EOK) { in FileWrite() 109 (void)realpath(fileName, filePath); in FileWrite() 110 if (strstr(filePath, "../") != NULL) { in FileWrite() 111 HKS_TEST_LOG_E("invalid filePath, path %s", filePath); in FileWrite() [all …]
|
/base/security/device_auth/services/frameworks/src/security_label_adapter/ |
D | security_label_adapter.c | 25 static int32_t GetSecurityLabel(const char *filePath, char **returnLabel) in GetSecurityLabel() argument 27 int32_t labelSize = getxattr(filePath, SECURITY_LABEL_XATTR_KEY, NULL, 0); in GetSecurityLabel() 37 labelSize = getxattr(filePath, SECURITY_LABEL_XATTR_KEY, label, labelSize); in GetSecurityLabel() 47 static bool IsSetLabelNeeded(const char *filePath, const char *labelToSet) in IsSetLabelNeeded() argument 50 if (GetSecurityLabel(filePath, &existLabel) != HC_SUCCESS) { in IsSetLabelNeeded() 62 void SetSecurityLabel(const char *filePath, const char *labelToSet) in SetSecurityLabel() argument 64 if (!IsSetLabelNeeded(filePath, labelToSet)) { in SetSecurityLabel() 67 int32_t res = setxattr(filePath, SECURITY_LABEL_XATTR_KEY, labelToSet, in SetSecurityLabel()
|
/base/sensors/miscdevice/utils/common/src/ |
D | file_utils.cpp | 38 std::string ReadJsonFile(const std::string &filePath) in ReadJsonFile() argument 40 if (filePath.empty()) { in ReadJsonFile() 45 if (realpath(filePath.c_str(), realPath) == nullptr) { in ReadJsonFile() 78 int32_t GetFileSize(const std::string &filePath) in GetFileSize() argument 81 if (stat(filePath.c_str(), &statbuf) != 0) { in GetFileSize() 109 char filePath[FILE_PATH_MAX] = {'\0'}; in GetFileName() local 117 ret = readlink(buf, filePath, FILE_PATH_MAX); in GetFileName() 123 fileName = filePath; in GetFileName() 148 bool CheckFileDir(const std::string &filePath, const std::string &dir) in CheckFileDir() argument 150 if (filePath.compare(0, CONFIG_DIR.size(), CONFIG_DIR) != 0) { in CheckFileDir() [all …]
|
/base/startup/appspawn/service/hnp/base/ |
D | hnp_file.c | 58 int ReadFileToStream(const char *filePath, char **stream, int *streamLen) in ReadFileToStream() argument 65 file = fopen(filePath, "rb"); in ReadFileToStream() 67 HNP_LOGE("open file[%s] unsuccess. ", filePath); in ReadFileToStream() 72 HNP_LOGE("get file[%s] size unsuccess.", filePath); in ReadFileToStream() 77 HNP_LOGE("get file[%s] size is null.", filePath); in ReadFileToStream() 100 int ReadFileToStreamBySize(const char *filePath, char **stream, int readSize) in ReadFileToStreamBySize() argument 106 file = fopen(filePath, "rb"); in ReadFileToStreamBySize() 108 HNP_LOGE("open file[%s] unsuccess. ", filePath); in ReadFileToStreamBySize() 135 int HnpWriteInfoToFile(const char* filePath, char *buff, int len) in HnpWriteInfoToFile() argument 137 FILE *fp = fopen(filePath, "w"); in HnpWriteInfoToFile() [all …]
|
/base/customization/config_policy/test/unittest/ |
D | config_policy_utils_test.cpp | 52 char *filePath = nullptr; in TestGetCfgFile() local 54 filePath = cfgFiles->paths[i]; in TestGetCfgFile() 55 if (filePath && *filePath != '\0') { in TestGetCfgFile() 56 std::cout << "type: " << type << ", filePath: " << filePath << std::endl; in TestGetCfgFile() 62 filePath = GetOneCfgFileEx(testPathSuffix, buf, MAX_PATH_LEN, type, extra); in TestGetCfgFile() 63 if (filePath && *filePath != '\0') { in TestGetCfgFile() 64 std::cout << "type: " << type << ", one filePath: " << filePath << std::endl; in TestGetCfgFile() 130 char *filePath = cfgDir->paths[i]; variable 131 if (filePath && *filePath != '\0') { 132 std::cout << "filePath: " << filePath << std::endl;
|
/base/msdp/device_status/libs/src/ |
D | devicestatus_data_parse.cpp | 133 std::string DeviceStatusDataParse::ReadJsonFile(const std::string &filePath) in ReadJsonFile() argument 135 if (filePath.empty()) { in ReadJsonFile() 140 if (realpath(filePath.c_str(), realPath) == nullptr) { in ReadJsonFile() 152 if (!Utility::DoesFileExist(filePath.c_str())) { in ReadJsonFile() 156 if (!CheckFileSize(filePath)) { in ReadJsonFile() 163 bool DeviceStatusDataParse::CheckFileDir(const std::string& filePath, const std::string& dir) in CheckFileDir() argument 165 if (filePath.compare(0, MSDP_DATA_DIR.size(), MSDP_DATA_DIR) != 0) { in CheckFileDir() 172 bool DeviceStatusDataParse::CheckFileSize(const std::string& filePath) in CheckFileSize() argument 174 int32_t fileSize = Utility::GetFileSize(filePath); in CheckFileSize() 182 bool DeviceStatusDataParse::CheckFileExtendName(const std::string& filePath, const std::string& che… in CheckFileExtendName() argument [all …]
|
/base/sensors/miscdevice/utils/common/include/ |
D | file_utils.h | 29 std::string ReadJsonFile(const std::string &filePath); 30 std::string ReadFile(const std::string &filePath); 31 bool CheckFileDir(const std::string &filePath, const std::string &dir); 32 bool CheckFileExtendName(const std::string &filePath, const std::string &checkExtension); 33 bool CheckFileSize(const std::string &filePath); 35 int32_t GetFileSize(const std::string &filePath);
|
/base/notification/distributed_notification_service/services/ans/src/common/ |
D | file_utils.cpp | 28 bool FileUtils::GetJsonByFilePath(const char *filePath, std::vector<nlohmann::json> &roots) in GetJsonByFilePath() argument 31 if (filePath == nullptr) { in GetJsonByFilePath() 38 CfgFiles *cfgFiles = GetCfgFiles(filePath); in GetJsonByFilePath() 40 ANS_LOGE("Not found filePath:%{public}s.", filePath); in GetJsonByFilePath() 53 ANS_LOGD("Use default notification config file path:%{public}s.", filePath); in GetJsonByFilePath() 54 ret = GetJsonFromFile(filePath, localRoot); in GetJsonByFilePath()
|
/base/msdp/device_status/libs/include/ |
D | devicestatus_data_parse.h | 37 bool CheckFileDir(const std::string &filePath, const std::string &dir); 38 bool CheckFileSize(const std::string &filePath); 39 bool CheckFileExtendName(const std::string &filePath, const std::string &checkExtension); 40 std::string ReadFile(const std::string &filePath); 41 std::string ReadJsonFile(const std::string &filePath);
|
/base/hiviewdfx/hiview/utility/common_utils/ |
D | calc_fingerprint.cpp | 59 int CalcFingerprint::CalcFileSha(const string& filePath, char *hash, size_t len) in CalcFileSha() argument 61 if (filePath.empty() || hash == nullptr || !FileUtil::IsLegalPath(filePath)) { in CalcFileSha() 66 int ret = CalcFileShaOriginal(filePath, value, len); in CalcFileSha() 74 int CalcFingerprint::CalcFileShaOriginal(const string& filePath, unsigned char *hash, size_t len) in CalcFileShaOriginal() argument 76 if (filePath.empty() || hash == nullptr || !FileUtil::IsLegalPath(filePath)) { in CalcFileShaOriginal() 87 fp = fopen(filePath.c_str(), "rb"); in CalcFileShaOriginal()
|
/base/hiviewdfx/hiappevent/frameworks/native/libhiappevent/utility/ |
D | file_util.cpp | 91 std::string filePath = GetFilePathByDir(dir, dirInfo->d_name); in ForceRemoveDirectory() local 92 if (!ForceRemoveDirectory(filePath)) { in ForceRemoveDirectory() 119 std::string filePath = GetFilePathByDir(dir, ent->d_name); in GetDirFiles() local 120 if (IsFile(filePath)) { // do not process subdirectory in GetDirFiles() 121 files.push_back(filePath); in GetDirFiles() 177 std::string filePath = dir; in GetFilePathByDir() local 178 if (filePath.back() != '/') { in GetFilePathByDir() 179 filePath.push_back(PATH_DELIMITER); in GetFilePathByDir() 181 filePath.append(fileName); in GetFilePathByDir() 182 return filePath; in GetFilePathByDir() [all …]
|
/base/request/request/frameworks/js/napi/src/upload/ |
D | obtain_file.cpp | 94 bool ObtainFile::IsValidPath(const std::string &filePath) in IsValidPath() argument 97 if (filePath.length() > PATH_MAX || realpath(filePath.c_str(), resolvedPath) == nullptr in IsValidPath() 98 || strncmp(resolvedPath, filePath.c_str(), filePath.length()) != 0) { in IsValidPath() 124 std::string filePath = fileAdapter_->InternalGetFilePath(context); in GetInternalFile() local 125 if (filePath.empty()) { in GetInternalFile() 129 filePath += "/" + fileName; in GetInternalFile() 130 if (!IsValidPath(filePath)) { in GetInternalFile() 133 FILE *filePtr = fopen(filePath.c_str(), "r"); in GetInternalFile()
|
/base/global/i18n/frameworks/intl/test/unittest/mock/src/ |
D | generate_ics_file.cpp | 34 std::string filePath = "/data/log/TR.ics"; in GenerateFile() local 35 std::ofstream fstream(filePath); in GenerateFile() 38 return filePath; in GenerateFile() 63 return filePath; in GenerateFile()
|
/base/security/code_signature/interfaces/innerkits/local_code_sign/src/ |
D | local_code_sign_kit.cpp | 28 int32_t LocalCodeSignKit::SignLocalCode(const std::string &filePath, ByteBuffer &signature) in SignLocalCode() argument 30 return LocalCodeSignClient::GetInstance().SignLocalCode("", filePath, signature); in SignLocalCode() 33 int32_t LocalCodeSignKit::SignLocalCode(const std::string &ownerID, const std::string &filePath, By… in SignLocalCode() argument 35 return LocalCodeSignClient::GetInstance().SignLocalCode(ownerID, filePath, signature); in SignLocalCode()
|
/base/hiviewdfx/blackbox_lite/ |
D | blackbox_detector.c | 18 int UploadEventByFile(const char *filePath) in UploadEventByFile() argument 20 if (filePath == NULL) { in UploadEventByFile() 21 BBOX_PRINT_ERR("filePath: %p\n", filePath); in UploadEventByFile()
|
/base/security/appverify/interfaces/innerkits/appverify/src/interfaces/ |
D | hap_verify.cpp | 86 int32_t HapVerify(const std::string& filePath, HapVerifyResult& hapVerifyResult) in HapVerify() argument 92 return hapVerifyV2.Verify(filePath, hapVerifyResult); in HapVerify() 95 int32_t ParseHapProfile(const std::string& filePath, HapVerifyResult& hapVerifyV1Result) in ParseHapProfile() argument 98 return hapVerifyV2.ParseHapProfile(filePath, hapVerifyV1Result); in ParseHapProfile() 101 int32_t ParseHapSignatureInfo(const std::string& filePath, SignatureInfo &hapSignInfo) in ParseHapSignatureInfo() argument 104 return hapVerifyV2.ParseHapSignatureInfo(filePath, hapSignInfo); in ParseHapSignatureInfo()
|
/base/hiviewdfx/hiview/base/event_store/store/ |
D | sys_event_doc.cpp | 127 std::string filePath = GetCurFile(dir); in UpdateCurFile() local 128 if (filePath.empty() || IsFileFull(filePath)) { in UpdateCurFile() 131 curFile_ = filePath; in UpdateCurFile() 169 std::string filePath = dir + FILE_SEPARATOR; in CreateCurFile() local 170 …filePath.append(name_).append(FILE_NAME_SEPARATOR).append(std::to_string(type_)).append(FILE_NAME_… in CreateCurFile() 172 …if (FileUtil::CreateFile(filePath, FileUtil::FILE_PERM_660) != 0 && !FileUtil::FileExists(filePath… in CreateCurFile() 173 HIVIEW_LOGE("failed to create file=%{public}s, errno=%{public}d", filePath.c_str(), errno); in CreateCurFile() 176 curFile_ = filePath; in CreateCurFile()
|
/base/update/sys_installer/services/module_update/util/src/ |
D | module_utils.cpp | 93 std::string GetHmpName(const std::string &filePath) in GetHmpName() argument 95 std::size_t endPos = filePath.find_last_of('/'); in GetHmpName() 97 LOG(ERROR) << "Invalid package path " << filePath; in GetHmpName() 103 if (StartsWith(filePath, iter)) { in GetHmpName() 109 LOG(ERROR) << "Invalid package path " << filePath; in GetHmpName() 112 return filePath.substr(startPos, endPos - startPos); in GetHmpName() 182 std::string GetRealPath(const std::string &filePath) in GetRealPath() argument 185 if (realpath(filePath.c_str(), path) == nullptr) { in GetRealPath() 186 LOG(ERROR) << "get real path fail " << filePath; in GetRealPath()
|
/base/theme/wallpaper_mgr/utils/src/ |
D | file_deal.cpp | 93 std::string FileDeal::GetExtension(const std::string &filePath) in GetExtension() argument 95 std::string filename = filePath; in GetExtension() 97 std::string::size_type pos = filePath.find_last_of('/'); in GetExtension() 99 if (pos + 1 < filePath.length()) { in GetExtension() 100 filename = filePath.substr(pos + 1); in GetExtension() 129 bool FileDeal::IsZipFile(const std::string &filePath) in IsZipFile() argument 131 fs::path file(filePath); in IsZipFile() 138 HILOG_ERROR("this is not a zip.filePath:%{private}s", filePath.c_str()); in IsZipFile()
|
/base/update/updateservice/services/core/ability/utils/src/ |
D | file_utils.cpp | 54 bool FileUtils::IsSpaceEnough(const std::string &filePath, const int64_t requiredSpace) in IsSpaceEnough() argument 58 int ret = statfs(filePath.c_str(), &diskStatfs); in IsSpaceEnough() 69 bool FileUtils::SaveDataToFile(const std::string &filePath, const std::string &data) in SaveDataToFile() argument 72 os.open(filePath, std::ios::trunc); in SaveDataToFile() 74 ENGINE_LOGI("SaveDataToFile success, file = %{public}s", filePath.c_str()); in SaveDataToFile() 79 ENGINE_LOGE("SaveDataToFile fail, file = %{public}s", filePath.c_str()); in SaveDataToFile() 205 std::string FileUtils::ReadDataFromFile(const std::string &filePath) in ReadDataFromFile() argument 208 if (realpath(filePath.c_str(), dealPath) == nullptr) { in ReadDataFromFile() 209 ENGINE_LOGE("filePath %{private}s is not exist or invalid", filePath.c_str()); in ReadDataFromFile() 215 ENGINE_LOGI("open file from %{public}s err", filePath.c_str()); in ReadDataFromFile()
|
/base/hiviewdfx/hisysevent/adapter/native/idl/src/ |
D | file_util.cpp | 81 std::string filePath = dir; in GetFilePathByDir() local 82 if (filePath.back() != '/') { in GetFilePathByDir() 83 filePath.push_back(PATH_DELIMITER); in GetFilePathByDir() 85 filePath.append(fileName); in GetFilePathByDir() 86 return filePath; in GetFilePathByDir()
|
/base/security/appverify/interfaces/innerkits/appverify/include/interfaces/ |
D | hap_verify.h | 29 DLL_EXPORT int32_t HapVerify(const std::string& filePath, HapVerifyResult& hapVerifyResult); 30 DLL_EXPORT int32_t ParseHapProfile(const std::string& filePath, HapVerifyResult& hapVerifyV1Result); 31 DLL_EXPORT int32_t ParseHapSignatureInfo(const std::string& filePath, SignatureInfo &hapSignInfo);
|