Properly deal with I/O errors when parsing config files.

Fixes #3152
This commit is contained in:
Gunnar Beutner 2013-01-23 09:57:06 +01:00
parent 17553e5cc4
commit 153ab33074
1 changed files with 3 additions and 1 deletions

View File

@ -55,7 +55,7 @@ ConfigCompiler::~ConfigCompiler(void)
*/
size_t ConfigCompiler::ReadInput(char *buffer, size_t max_size)
{
m_Input->read(buffer, max_size);
m_Input->readsome(buffer, max_size);
return static_cast<size_t>(m_Input->gcount());
}
@ -122,6 +122,8 @@ void ConfigCompiler::HandleLibrary(const String& library)
vector<ConfigItem::Ptr> ConfigCompiler::CompileStream(const String& path,
istream *stream)
{
stream->exceptions(istream::failbit | istream::badbit);
ConfigCompiler ctx(path, stream);
ctx.Compile();
return ctx.GetResult();