Security config: skip hidden files

Also: fix a small memory leak
This commit is contained in:
lbonn 2017-10-06 16:23:59 +02:00
parent fff684b98e
commit e7df811f10

View file

@ -550,9 +550,12 @@ bool load_main_config(const char *file, bool is_active) {
strcpy(_path, base); strcpy(_path, base);
strcat(_path, ent->d_name); strcat(_path, ent->d_name);
lstat(_path, &s); lstat(_path, &s);
if (S_ISREG(s.st_mode)) { if (S_ISREG(s.st_mode) && ent->d_name[0] != '.') {
list_add(secconfigs, _path); list_add(secconfigs, _path);
} }
else {
free(_path);
}
ent = readdir(dir); ent = readdir(dir);
} }
closedir(dir); closedir(dir);