From ec0813e4e66172bff73f09772257a580723575bd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 16 Apr 2020 20:58:19 +0300 Subject: Fix crashing on unhandled io_error thrown by depdb::flush() --- libbuild2/depdb.ixx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libbuild2/depdb.ixx b/libbuild2/depdb.ixx index 92afa32..819fadd 100644 --- a/libbuild2/depdb.ixx +++ b/libbuild2/depdb.ixx @@ -1,6 +1,8 @@ // file : libbuild2/depdb.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include + namespace build2 { inline depdb_base:: @@ -16,7 +18,14 @@ namespace build2 flush () { if (state_ == state::write) + try + { os_.flush (); + } + catch (const io_error& e) + { + fail << "unable to flush " << path << ": " << e; + } } inline bool depdb:: -- cgit v1.1