diff options
author | Marius Kintel <marius@kintel.net> | 2013-06-21 05:36:08 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-06-21 05:36:08 (GMT) |
commit | ec867349fff100ac783cb91a343b8c2584e83b61 (patch) | |
tree | 538f5483ddf3a9afaab0c2b6a6d2d6f85af5d24f /src/ModuleCache.cc | |
parent | 2da488800c88da7e9731595b22f2bf160b63bedb (diff) |
Close file as soon as possible to avoid potential readlocks being kept too long. Might be enough for #415
Diffstat (limited to 'src/ModuleCache.cc')
-rw-r--r-- | src/ModuleCache.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index de9af01..1b7a9e5 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -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(); |