Fix infinite loop bug when file is not found

This commit is contained in:
Tatsuhiro Tsujikawa 2017-05-20 12:45:00 +09:00
parent 9677586336
commit 8785342f85
2 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ typename Parser::ResultType parseFile(Parser& parser,
// TODO Overrode a2open(const char*,..) and a2open(const std::wstring&,..)
while ((fd = a2open(utf8ToWChar(filename).c_str(), O_BINARY | O_RDONLY,
OPEN_MODE)) == -1 &&
errno != EINTR)
errno == EINTR)
;
if (fd == -1) {
return Parser::ParserStateMachineType::noResult();

View File

@ -52,7 +52,7 @@ bool parseFile(const std::string& filename, ParserStateMachine* psm)
else {
while ((fd = a2open(utf8ToWChar(filename).c_str(), O_BINARY | O_RDONLY,
OPEN_MODE)) == -1 &&
errno != EINTR)
errno == EINTR)
;
if (fd == -1) {
return false;