提交 89abbd2e 编写于 作者: Y YuQing

use readdir instead of readdir_r in Linux

上级 7190fad3
Version 1.45 2020-12-24 Version 1.45 2020-12-24
* add function uniq_skiplist_find_node_ex * add function uniq_skiplist_find_node_ex
* use readdir instead of readdir_r in Linux
Version 1.44 2020-12-06 Version 1.44 2020-12-06
* add test file src/tests/test_pthread_lock.c * add test file src/tests/test_pthread_lock.c
......
...@@ -533,7 +533,9 @@ static int log_get_matched_files(LogContext *pContext, ...@@ -533,7 +533,9 @@ static int log_get_matched_files(LogContext *pContext,
char *log_filename; char *log_filename;
char *filename; char *filename;
DIR *dir; DIR *dir;
#ifndef OS_LINUX
struct dirent ent; struct dirent ent;
#endif
struct dirent *pEntry; struct dirent *pEntry;
time_t the_time; time_t the_time;
struct tm tm; struct tm tm;
...@@ -579,7 +581,12 @@ static int log_get_matched_files(LogContext *pContext, ...@@ -579,7 +581,12 @@ static int log_get_matched_files(LogContext *pContext,
strftime(filename_prefix + len, sizeof(filename_prefix) - len, strftime(filename_prefix + len, sizeof(filename_prefix) - len,
rotate_time_format_prefix, &tm); rotate_time_format_prefix, &tm);
prefix_filename_len = strlen(filename_prefix); prefix_filename_len = strlen(filename_prefix);
#ifndef OS_LINUX
while (readdir_r(dir, &ent, &pEntry) == 0) while (readdir_r(dir, &ent, &pEntry) == 0)
#else
while ((pEntry=readdir(dir)) != NULL)
#endif
{ {
if (pEntry == NULL) if (pEntry == NULL)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册