Explorar o código

Fix infinite loop bug when file is not found

Tatsuhiro Tsujikawa %!s(int64=8) %!d(string=hai) anos
pai
achega
8785342f85
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      src/GenericParser.h
  2. 1 1
      src/XmlParser.cc

+ 1 - 1
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();

+ 1 - 1
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;