From 8785342f8555992327f1ab0f7060c7e69dde5fd2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 20 May 2017 12:45:00 +0900 Subject: [PATCH] Fix infinite loop bug when file is not found --- src/GenericParser.h | 2 +- src/XmlParser.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GenericParser.h b/src/GenericParser.h index 09e42146..86c6ca92 100644 --- a/src/GenericParser.h +++ b/src/GenericParser.h @@ -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(); diff --git a/src/XmlParser.cc b/src/XmlParser.cc index dde216c6..15b273d7 100644 --- a/src/XmlParser.cc +++ b/src/XmlParser.cc @@ -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;