diff options
author | Costa Tsaousis <costa@tsaousis.gr> | 2018-12-06 01:02:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 01:02:50 +0200 |
commit | 7c5b00e02ce2d1ea6d84a7fc3b63de95d9b515cf (patch) | |
tree | 84afb5570d758f3c855e2622cc83c76c6f05d5d8 /libnetdata/libnetdata.c | |
parent | e4f474ee042c1901af23c1dcbe32f7e2699f8ce0 (diff) |
fix symbolic link file detection in etc (#4926)
Diffstat (limited to 'libnetdata/libnetdata.c')
-rw-r--r-- | libnetdata/libnetdata.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 3972052a3a..53c580a9b6 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -1380,7 +1380,8 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p continue; } } - else if(de->d_type == DT_UNKNOWN || de->d_type == DT_REG || de->d_type == DT_LNK) { + + if(de->d_type == DT_UNKNOWN || de->d_type == DT_REG || de->d_type == DT_LNK) { size_t len = strlen(de->d_name); if(path_is_file(udir, de->d_name) && len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) { @@ -1388,13 +1389,11 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename); callback(filename, data); freez(filename); + continue; } - else - debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s'", udir, de->d_name); - } - else { - debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' with invalid type %d", udir, de->d_name, (int)de->d_type); } + + debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); } closedir(dir); @@ -1428,7 +1427,8 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p continue; } } - else if(de->d_type == DT_UNKNOWN || de->d_type == DT_REG || de->d_type == DT_LNK) { + + if(de->d_type == DT_UNKNOWN || de->d_type == DT_REG || de->d_type == DT_LNK) { size_t len = strlen(de->d_name); if(path_is_file(sdir, de->d_name) && !path_is_file(udir, de->d_name) && len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) { @@ -1436,13 +1436,12 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename); callback(filename, data); freez(filename); + continue; } - else - debug(D_HEALTH, "CONFIG ignoring stock config file '%s/%s'", sdir, de->d_name); - } - else { - debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' with invalid type %d", udir, de->d_name, (int)de->d_type); + } + + debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); } closedir(dir); |