summaryrefslogtreecommitdiffstats
path: root/Source/LexerParser
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2017-08-25 14:28:21 (GMT)
committerMatthias Maennich <matthias@maennich.net>2017-08-25 14:53:19 (GMT)
commit9cacb0cba43188f4fe39b042581579c54cca44ba (patch)
tree7223542231c9b5d3c21b10e21807447f0d5841e5 /Source/LexerParser
parentc7c639f2f363b6918ac13daea214cea56035e0aa (diff)
downloadCMake-9cacb0cba43188f4fe39b042581579c54cca44ba.zip
CMake-9cacb0cba43188f4fe39b042581579c54cca44ba.tar.gz
CMake-9cacb0cba43188f4fe39b042581579c54cca44ba.tar.bz2
cmListFileLexer: fix 'bail out on seek-errors' also in original file
The commit v3.9.0-rc1~502^2 (cmListFileLexer: bail out on seek-errors, 2017-02-19) for bug # 16607 was only applied to the generated file. Also apply the fix now to the original. Signed-off-by: Matthias Maennich <matthias@maennich.net>
Diffstat (limited to 'Source/LexerParser')
-rw-r--r--Source/LexerParser/cmListFileLexer.in.l8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/LexerParser/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l
index 5152dbf..8ec82cc 100644
--- a/Source/LexerParser/cmListFileLexer.in.l
+++ b/Source/LexerParser/cmListFileLexer.in.l
@@ -439,11 +439,15 @@ static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f)
if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) {
return cmListFileLexer_BOM_UTF32LE;
}
- fsetpos(f, &p);
+ if (fsetpos(f, &p) != 0) {
+ return cmListFileLexer_BOM_Broken;
+ }
return cmListFileLexer_BOM_UTF16LE;
}
}
- rewind(f);
+ if (fseek(f, 0, SEEK_SET) != 0) {
+ return cmListFileLexer_BOM_Broken;
+ }
return cmListFileLexer_BOM_None;
}