未验证 提交 c11ff9dd 编写于 作者: O openharmony_ci 提交者: Gitee

!724 解决init log 异常

Merge pull request !724 from Mupceet/initbeta
......@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
printf("Failed to get shell handle \n");
return 0;
}
SetInitLogLevel(0);
BShellParamCmdRegister(handle, 0);
#ifdef INIT_TEST
BShellCmdRegister(handle, 0);
......
......@@ -73,7 +73,6 @@ int main(int argc, char *args[])
tio.c_cc[VMIN] = 1;
tcsetattr(0, TCSAFLUSH, &tio);
SetInitLogLevel(0);
BSH_LOGV("BShellEnvStart %d", argc);
do {
BShellHandle handle = GetShellHandle();
......
......@@ -32,6 +32,7 @@
#include "hilog_base/log_base.h"
#endif
#define DEF_LOG_SIZE 128
#define MAX_LOG_SIZE 1024
#define BASE_YEAR 1900
......@@ -105,9 +106,13 @@ void InitLog(InitLogLevel logLevel, unsigned int domain, const char *tag, const
}
va_list vargs;
va_start(vargs, fmt);
char tmpFmt[MAX_LOG_SIZE];
if (vsnprintf_s(tmpFmt, MAX_LOG_SIZE, MAX_LOG_SIZE - 1, fmt, vargs) == -1) {
char tmpFmt[DEF_LOG_SIZE] = {0};
if (vsnprintf_s(tmpFmt, sizeof(tmpFmt), sizeof(tmpFmt) - 1, fmt, vargs) == -1) {
va_end(vargs);
#ifdef OHOS_LITE
static LogLevel LOG_LEVEL[] = { LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL };
(void)HiLogPrint(INIT_LOG_INIT, LOG_LEVEL[logLevel], domain, tag, "%{public}s", fmt);
#endif
return;
}
va_end(vargs);
......
......@@ -700,7 +700,6 @@ WorkSpace *GetWorkSpace(const char *name)
space = HASHMAP_ENTRY(node, WorkSpace, hashNode);
}
WORKSPACE_RW_UNLOCK(g_paramWorkSpace);
PARAM_LOGV("GetWorkSpace %s space-name %s, space %p", name, tmpName, space);
return (space != NULL && space->area != NULL) ? space : NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册