diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 27ecef10d..5155b19a4 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -1187,6 +1187,8 @@ void OpenFStream( boost_iostreams& fstream, const std::string& filename) { IOFile file(filename, "r"); + if (file.GetFd() == -1) + return; int fd = dup(file.GetFd()); if (fd == -1) return; @@ -1199,6 +1201,8 @@ template <> void OpenFStream( boost_iostreams& fstream, const std::string& filename) { IOFile file(filename, "w"); + if (file.GetFd() == -1) + return; int fd = dup(file.GetFd()); if (fd == -1) return;