mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-18 01:31:04 -05:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user