Skip to content

Commit

Permalink
Merge pull request rdkcentral#5276 from sborushevsky/RDKTV-30706
Browse files Browse the repository at this point in the history
RDKTV-30706 : Added check if that is the file to fileExists()
  • Loading branch information
anand-ky authored May 13, 2024
2 parents b4a44b4 + 29039af commit 3b5f4ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helpers/UtilsfileExists.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
3 changes: 1 addition & 2 deletions helpers/cSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3b5f4ef

Please sign in to comment.