From ad1c474dc6286bda868f83eecc174a910a61f06a Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 3 Apr 2024 15:29:08 +0800 Subject: [PATCH] fix: logFileHandle NULL --- source/util/src/tlog.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 16ca1b64c3..7802b77e6a 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -242,6 +242,7 @@ void taosCloseLog() { taosMemoryFreeClear(tsLogObj.logHandle->buffer); taosThreadMutexDestroy(&tsLogObj.logMutex); taosMemoryFreeClear(tsLogObj.logHandle); + tsLogObj.logHandle = NULL; } } @@ -347,10 +348,11 @@ void taosResetLog() { // force create a new log file tsLogObj.lines = tsNumOfLogLines + 10; - taosOpenNewLogFile(); - - uInfo("=================================="); - uInfo(" reset log file "); + if (tsLogObj.logHandle) { + taosOpenNewLogFile(); + uInfo("=================================="); + uInfo(" reset log file "); + } } static bool taosCheckFileIsOpen(char *logFileName) {