Skip to content
Snippets Groups Projects
Commit 7a9c0eea authored by David Cole's avatar David Cole
Browse files

Fix crash on Windows. If input stream is no good, do not try to read a line...

Fix crash on Windows. If input stream is no good, do not try to read a line from it. Return false and an empty line instead...
parent fbb01944
No related branches found
No related tags found
No related merge requests found
...@@ -3959,10 +3959,11 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, ...@@ -3959,10 +3959,11 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
line = ""; line = "";
long leftToRead = sizeLimit; long leftToRead = sizeLimit;
// If no characters are read from the stream, the end of file has // If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading. // been reached. Clear the fail bit just before reading.
while(!haveNewline && while(is &&
!haveNewline &&
leftToRead != 0 && leftToRead != 0 &&
(is.clear(is.rdstate() & ~kwsys_ios::ios::failbit), (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
is.getline(buffer, bufferSize), is.gcount() > 0)) is.getline(buffer, bufferSize), is.gcount() > 0))
......
...@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2009) ...@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2009)
SET(KWSYS_DATE_STAMP_MONTH 10) SET(KWSYS_DATE_STAMP_MONTH 10)
# KWSys version date day component. Format is DD. # KWSys version date day component. Format is DD.
SET(KWSYS_DATE_STAMP_DAY 09) SET(KWSYS_DATE_STAMP_DAY 16)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment