diff options
author | David Cole <david.cole@kitware.com> | 2009-10-16 15:43:05 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-10-16 15:43:05 (GMT) |
commit | 9578bfc0efe5c2d667c7336e247274f1ad8f0e25 (patch) | |
tree | cc010d101d1aac82b235ac2d511e8a46d84c2ffd /Source | |
parent | 023889cb2cf0198c9e502aa5c3db3850be011f46 (diff) | |
download | CMake-9578bfc0efe5c2d667c7336e247274f1ad8f0e25.zip CMake-9578bfc0efe5c2d667c7336e247274f1ad8f0e25.tar.gz CMake-9578bfc0efe5c2d667c7336e247274f1ad8f0e25.tar.bz2 |
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...
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8ed6315..3c19018 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -3959,10 +3959,11 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, line = ""; long leftToRead = sizeLimit; - + // If no characters are read from the stream, the end of file has // been reached. Clear the fail bit just before reading. - while(!haveNewline && + while(is && + !haveNewline && leftToRead != 0 && (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit), is.getline(buffer, bufferSize), is.gcount() > 0)) |