1
0
mirror of https://github.com/armink/EasyLogger.git synced 2025-01-31 13:32:52 +08:00

Merge pull request #129 from slark-yuxj/master

增加对文件空指针的判断
This commit is contained in:
朱天龙 (Armink) 2022-12-07 19:30:14 +08:00 committed by GitHub
commit 6afd86d75e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ static bool elog_file_rotate(void)
#define SUFFIX_LEN 10
/* mv xxx.log.n-1 => xxx.log.n, and xxx.log => xxx.log.0 */
int n, err = 0;
char oldpath[256], newpath[256];
char oldpath[256]= {0}, newpath[256] = {0};
size_t base = strlen(local_cfg.name);
bool result = true;
FILE *tmp_fp;
@ -113,6 +113,9 @@ void elog_file_write(const char *log, size_t size)
ELOG_ASSERT(init_ok);
ELOG_ASSERT(log);
if(fp == NULL) {
return;
}
elog_file_port_lock();