diff --git a/CHANGES b/CHANGES index cae42f8f..75d123a7 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN-HEAD isadump: Use geteuid instead of getuid so that setuid bit works isaset: Use geteuid instead of getuid so that setuid bit works + libsensors: Don't rely on dirent->dt_type being set Makefile: Include generated source files in dependency checking Make it possible to skip building of the static library fancontrol: Add support for absolute path to hwmon devices diff --git a/lib/init.c b/lib/init.c index e97f6882..f15ec6cc 100644 --- a/lib/init.c +++ b/lib/init.c @@ -23,12 +23,14 @@ #define _BSD_SOURCE #include +#include #include #include #include #include #include #include +#include #include "sensors.h" #include "data.h" #include "error.h" @@ -120,8 +122,7 @@ exit_cleanup: static int config_file_filter(const struct dirent *entry) { - return (entry->d_type == DT_REG || entry->d_type == DT_LNK) - && entry->d_name[0] != '.'; /* Skip hidden files */ + return entry->d_name[0] != '.'; /* Skip hidden files */ } static int add_config_from_dir(const char *dir) @@ -143,6 +144,7 @@ static int add_config_from_dir(const char *dir) int len; char path[PATH_MAX]; FILE *input; + struct stat st; len = snprintf(path, sizeof(path), "%s/%s", dir, namelist[i]->d_name); @@ -151,6 +153,10 @@ static int add_config_from_dir(const char *dir) continue; } + /* Only accept regular files */ + if (stat(path, &st) < 0 || !S_ISREG(st.st_mode)) + continue; + input = fopen(path, "r"); if (input) { res = parse_config(input, path);