Close file as soon as possible to avoid potential readlocks being kept too long. Might be enough for #415

issue480
Marius Kintel 2013-06-21 01:36:08 -04:00
parent 2da488800c
commit ec867349ff
1 changed files with 8 additions and 6 deletions

View File

@ -74,13 +74,15 @@ FileModule *ModuleCache::evaluate(const std::string &filename)
}
#endif
std::ifstream ifs(filename.c_str());
if (!ifs.is_open()) {
PRINTB("WARNING: Can't open library file '%s'\n", filename);
return NULL;
}
std::stringstream textbuf;
textbuf << ifs.rdbuf();
{
std::ifstream ifs(filename.c_str());
if (!ifs.is_open()) {
PRINTB("WARNING: Can't open library file '%s'\n", filename);
return NULL;
}
textbuf << ifs.rdbuf();
}
textbuf << "\n" << commandline_commands;
print_messages_push();