提交 e13ba3b5 编写于 作者: J jingrui

isulad: optimize shim or runtime error message

Signed-off-by: Njingrui <jingrui@huawei.com>
上级 d7a3c206
...@@ -123,20 +123,29 @@ static char *get_err_message(const char *workdir, const char *file) ...@@ -123,20 +123,29 @@ static char *get_err_message(const char *workdir, const char *file)
static void show_shim_runtime_errlog(const char *workdir) static void show_shim_runtime_errlog(const char *workdir)
{ {
char *msg = NULL; char buf[BUFSIZ] = {0};
char *log1 = NULL;
char *log2 = NULL;
msg = get_err_message(workdir, "shim-log.json"); log1 = get_err_message(workdir, "shim-log.json");
if (msg != NULL) { if (log1 != NULL) {
ERROR("shim-log error %s", msg); ERROR("shim-log error %s", log1);
isulad_set_error_message("shim-log error %s", msg); } else {
free(msg); log1 = util_strdup_s("NULL");
} }
msg = get_err_message(workdir, "log.json");
if (msg != NULL) { log2 = get_err_message(workdir, "log.json");
ERROR("runtime-log error %s", msg); if (log2 != NULL) {
isulad_set_error_message("runtime-log error %s", msg); ERROR("runtime-log error %s", log2);
free(msg); } else {
log2 = util_strdup_s("NULL");
} }
(void)snprintf(buf, sizeof(buf), "shim-log error: %s\nruntime-log error: %s\n", log1, log2);
isulad_set_error_message(buf);
UTIL_FREE_AND_SET_NULL(log1);
UTIL_FREE_AND_SET_NULL(log2);
} }
bool rt_isula_detect(const char *runtime) bool rt_isula_detect(const char *runtime)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册