代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/rsyslog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5ce33ba295e9e210aff7cb137998d8490583d516 Mon Sep 17 00:00:00 2001
From: wangshouping <[email protected]>
Date: Wed, 15 Apr 2020 03:07:55 -0400
Subject: [PATCH] rsyslog-8.37.0-initialize-variables-and-check-return-value
Signed-off-by: wangshouping <[email protected]>
---
plugins/imjournal/imjournal.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
index aa27fe7..c5d3d25 100644
--- a/plugins/imjournal/imjournal.c
+++ b/plugins/imjournal/imjournal.c
@@ -386,7 +386,7 @@ readjournal(void)
struct timeval tv;
uint64_t timestamp;
- uint64_t monotonic_timestamp;
+ uint64_t monotonic_timestamp = 0;
struct fjson_object *json = NULL;
int r;
@@ -396,8 +396,8 @@ readjournal(void)
char *sys_iden;
char *sys_iden_help = NULL;
- char *t;
- char *tpmessage;
+ char *t = NULL;
+ char *tpmessage = NULL;
const void *get;
const void *pidget;
@@ -508,13 +508,17 @@ readjournal(void)
if (journalGetData("_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0)
{
t = strndup(get+28, length-28);
- monotonic_timestamp = atoll(t);
- free(t);
+ if (t != NULL) {
+ monotonic_timestamp = atoll(t);
+ free(t);
+ }
tpmessage = (char *)malloc(strlen(message)+30);
- int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
- memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
- enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
- free(tpmessage);
+ if (tpmessage != NULL) {
+ int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
+ memcpy(tpmessage+(ret >= 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
+ enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
+ free(tpmessage);
+ }
}else
/* submit message */
enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。