From 39aa10d82d6187d5cc33859b0bf8b96e5c7569e7 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 31 Dec 2014 19:31:20 +0000 Subject: [PATCH] Fix for: https://github.com/boostorg/regex/pull/9 --- src/fileiter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 780a12f1..5f65127f 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -267,14 +267,15 @@ void mapfile::lock(pointer* node)const read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); else read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile); -#ifndef BOOST_NO_EXCEPTIONS if((read_size == 0) || (std::ferror(hfile))) { +#ifndef BOOST_NO_EXCEPTIONS + unlock(node); throw std::runtime_error("Unable to read file."); - } #else - BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); + BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); #endif + } } else {