fix: reserve log file name

This commit is contained in:
kailixu 2024-06-12 08:27:46 +08:00
parent f1fa948594
commit db44febadf
1 changed files with 6 additions and 7 deletions

View File

@ -289,15 +289,14 @@ static void taosReserveOldLog(char *oldName, char *keepName) {
} }
static void taosKeepOldLog(char *oldName) { static void taosKeepOldLog(char *oldName) {
if (oldName[0] == '\0') goto _end; if (oldName[0] != 0) {
char compressFileName[LOG_FILE_NAME_LEN + 20];
char compressFileName[LOG_FILE_NAME_LEN + 20]; snprintf(compressFileName, LOG_FILE_NAME_LEN + 20, "%s.gz", oldName);
snprintf(compressFileName, LOG_FILE_NAME_LEN + 20, "%s.gz", oldName); if (taosCompressFile(oldName, compressFileName) == 0) {
if (taosCompressFile(oldName, compressFileName) == 0) { (void)taosRemoveFile(oldName);
(void)taosRemoveFile(oldName); }
} }
_end:
if (tsLogKeepDays > 0) { if (tsLogKeepDays > 0) {
taosRemoveOldFiles(tsLogDir, tsLogKeepDays); taosRemoveOldFiles(tsLogDir, tsLogKeepDays);
} }