use readdir instead of readdir_r in Linux
parent
7190fad3d0
commit
89abbd2ee4
1
HISTORY
1
HISTORY
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue