use readdir instead of readdir_r in Linux

storage_pool
YuQing 2020-12-24 18:34:16 +08:00
parent 7190fad3d0
commit 89abbd2ee4
2 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
Version 1.45 2020-12-24
* add function uniq_skiplist_find_node_ex
* use readdir instead of readdir_r in Linux
Version 1.44 2020-12-06
* add test file src/tests/test_pthread_lock.c

View File

@ -533,7 +533,9 @@ static int log_get_matched_files(LogContext *pContext,
char *log_filename;
char *filename;
DIR *dir;
#ifndef OS_LINUX
struct dirent ent;
#endif
struct dirent *pEntry;
time_t the_time;
struct tm tm;
@ -579,7 +581,12 @@ static int log_get_matched_files(LogContext *pContext,
strftime(filename_prefix + len, sizeof(filename_prefix) - len,
rotate_time_format_prefix, &tm);
prefix_filename_len = strlen(filename_prefix);
#ifndef OS_LINUX
while (readdir_r(dir, &ent, &pEntry) == 0)
#else
while ((pEntry=readdir(dir)) != NULL)
#endif
{
if (pEntry == NULL)
{