diff --git a/helpers/UtilsfileExists.h b/helpers/UtilsfileExists.h index 9173457d32..13fc840c8f 100644 --- a/helpers/UtilsfileExists.h +++ b/helpers/UtilsfileExists.h @@ -6,6 +6,6 @@ namespace Utils { inline bool fileExists(const char* pFileName) { struct stat fileStat; - return 0 == stat(pFileName, &fileStat); + return 0 == stat(pFileName, &fileStat) && S_IFREG == (fileStat.st_mode & S_IFMT); } } diff --git a/helpers/cSettings.h b/helpers/cSettings.h index d6590e16b4..2c34f14067 100644 --- a/helpers/cSettings.h +++ b/helpers/cSettings.h @@ -195,8 +195,7 @@ class cSettings { } fstream ifile(filename, ios::in); if (ifile) { - while (!ifile.eof()) { - std::getline(ifile, content); + while (std::getline(ifile, content)) { size_t pos = content.find_last_of("="); if (std::string::npos != pos) { data[(content.substr(0, pos).c_str())] = content.substr(pos + 1, std::string::npos);