id summary reporter owner description type status milestone component version severity resolution keywords cc 12489 "file_lock and fstream read causes ""permission denied""" anonymous Ion Gaztañaga "The following code causes an exception in the std::getline. The error message received by strerror() is ""permission denied"". The exception goes away by removing the lock and unlock line. This issue is related to to https://svn.boost.org/trac/boost/ticket/2796 which focuses on writing to the filelock. A ""workaround"" for that issue is to unlock before flushing the stream. It is not an option to read file before locking it. How can this issue be fixed? Any possible workaround? #include ""stdafx.h"" #include #include #include int main(int argc, char* argv[]) { std::fstream stream(""lock"", std::fstream::in | std::fstream::out); stream.exceptions(std::fstream::badbit | std::fstream::failbit); boost::interprocess::file_lock lock(""lock""); lock.lock(); std::string content; try { std::getline(stream, content); } catch (std::exception) { auto desc = strerror(errno); } std::cout << content << std::endl; lock.unlock(); stream.close(); return 0; } " Bugs new To Be Determined interprocess Boost 1.61.0 Problem