mirror of
https://github.com/emqx/neuron.git
synced 2026-10-19 23:02:33 +08:00
Merge pull request #1499 from ZhouBox/v2.6
[v2.6]fixbug:log file name filtering error
This commit is contained in:
+5
-8
@@ -27,11 +27,10 @@
|
||||
|
||||
static UT_array *collect_logs(const char *dir, const char *node)
|
||||
{
|
||||
DIR * dirp = NULL;
|
||||
struct dirent *dent = NULL;
|
||||
UT_array * files = NULL;
|
||||
char flag[NEU_NODE_NAME_LEN + 2] = { 0 };
|
||||
char flag_[NEU_NODE_NAME_LEN + 2] = { 0 };
|
||||
DIR * dirp = NULL;
|
||||
struct dirent *dent = NULL;
|
||||
UT_array * files = NULL;
|
||||
char flag[NEU_NODE_NAME_LEN + 2] = { 0 };
|
||||
|
||||
if ((dirp = opendir(dir)) == NULL) {
|
||||
nlog_error("fail open dir: %s", dir);
|
||||
@@ -40,11 +39,9 @@ static UT_array *collect_logs(const char *dir, const char *node)
|
||||
|
||||
utarray_new(files, &ut_str_icd);
|
||||
snprintf(flag, sizeof(flag), "%s.", node);
|
||||
snprintf(flag_, sizeof(flag_), "%s_", node);
|
||||
|
||||
while (NULL != (dent = readdir(dirp))) {
|
||||
if (strstr(dent->d_name, flag) != NULL ||
|
||||
strstr(dent->d_name, flag_) != NULL) {
|
||||
if (strstr(dent->d_name, flag) != NULL) {
|
||||
char *file = dent->d_name;
|
||||
utarray_push_back(files, &file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user