!499 LiteOS_A BBOX Codex整改
Merge pull request !499 from pcwlno1/cherry-pick-1628038487
This commit is contained in:
commit
e32b3a00fa
|
@ -113,10 +113,14 @@ int SaveBasicErrorInfo(const char *filePath, struct ErrorInfo *info)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)memset_s(buf, ERROR_INFO_MAX_LEN, 0, ERROR_INFO_MAX_LEN);
|
(void)memset_s(buf, ERROR_INFO_MAX_LEN, 0, ERROR_INFO_MAX_LEN);
|
||||||
(void)snprintf_s(buf, ERROR_INFO_MAX_LEN, ERROR_INFO_MAX_LEN - 1,
|
if (snprintf_s(buf, ERROR_INFO_MAX_LEN, ERROR_INFO_MAX_LEN - 1,
|
||||||
ERROR_INFO_HEADER_FORMAT, info->event, info->module, info->errorDesc);
|
ERROR_INFO_HEADER_FORMAT, info->event, info->module, info->errorDesc) != -1) {
|
||||||
*(buf + ERROR_INFO_MAX_LEN - 1) = '\0';
|
*(buf + ERROR_INFO_MAX_LEN - 1) = '\0';
|
||||||
(void)FullWriteFile(filePath, buf, strlen(buf), 0);
|
(void)FullWriteFile(filePath, buf, strlen(buf), 0);
|
||||||
|
} else {
|
||||||
|
BBOX_PRINT_ERR("buf is not enough or snprintf_s failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
(void)LOS_MemFree(m_aucSysMem1, buf);
|
(void)LOS_MemFree(m_aucSysMem1, buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -80,10 +80,16 @@ static void FormatErrorInfo(struct ErrorInfo *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)memset_s(info, sizeof(*info), 0, sizeof(*info));
|
(void)memset_s(info, sizeof(*info), 0, sizeof(*info));
|
||||||
(void)strncpy_s(info->event, sizeof(info->event), event, Min(strlen(event), sizeof(info->event) - 1));
|
if (strncpy_s(info->event, sizeof(info->event), event, Min(strlen(event), sizeof(info->event) - 1)) != EOK) {
|
||||||
(void)strncpy_s(info->module, sizeof(info->module), module, Min(strlen(module), sizeof(info->module) - 1));
|
BBOX_PRINT_ERR("info->event is not enough or strncpy_s failed!\n");
|
||||||
(void)strncpy_s(info->errorDesc, sizeof(info->errorDesc), errorDesc,
|
}
|
||||||
Min(strlen(errorDesc), sizeof(info->errorDesc) - 1));
|
if (strncpy_s(info->module, sizeof(info->module), module, Min(strlen(module), sizeof(info->module) - 1)) != EOK) {
|
||||||
|
BBOX_PRINT_ERR("info->module is not enough or strncpy_s failed!\n");
|
||||||
|
}
|
||||||
|
if (strncpy_s(info->errorDesc, sizeof(info->errorDesc), errorDesc,
|
||||||
|
Min(strlen(errorDesc), sizeof(info->errorDesc) - 1)) != EOK) {
|
||||||
|
BBOX_PRINT_ERR("info->errorDesc is not enough or strncpy_s failed!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOSCFG_FS_VFS
|
#ifdef LOSCFG_FS_VFS
|
||||||
|
@ -351,7 +357,11 @@ int BBoxRegisterModuleOps(struct ModuleOps *ops)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)memset_s(newOps, sizeof(*newOps), 0, sizeof(*newOps));
|
(void)memset_s(newOps, sizeof(*newOps), 0, sizeof(*newOps));
|
||||||
(void)memcpy_s(&newOps->ops, sizeof(newOps->ops), ops, sizeof(*ops));
|
if (memcpy_s(&newOps->ops, sizeof(newOps->ops), ops, sizeof(*ops)) != EOK) {
|
||||||
|
BBOX_PRINT_ERR("newOps->ops is not enough or memcpy_s failed!\n");
|
||||||
|
(void)LOS_MemFree(m_aucSysMem1, newOps);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) {
|
if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) {
|
||||||
BBOX_PRINT_ERR("Request g_opsListSem failed!\n");
|
BBOX_PRINT_ERR("Request g_opsListSem failed!\n");
|
||||||
(void)LOS_MemFree(m_aucSysMem1, newOps);
|
(void)LOS_MemFree(m_aucSysMem1, newOps);
|
||||||
|
|
Loading…
Reference in New Issue