From ec867349fff100ac783cb91a343b8c2584e83b61 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 21 Jun 2013 01:36:08 -0400 Subject: Close file as soon as possible to avoid potential readlocks being kept too long. Might be enough for #415 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(); -- cgit v0.10.1