From ab080add26815ceef754c6ebaa2f2512e1f954cf Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Aug 2020 19:40:52 +0300 Subject: Fix assertion failure in path_search() on Windows Also fix the similar potential assertion failure in fdstream. --- libbutl/fdstream.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'libbutl/fdstream.cxx') diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx index 0a5525c..377681e 100644 --- a/libbutl/fdstream.cxx +++ b/libbutl/fdstream.cxx @@ -1567,11 +1567,19 @@ namespace butl } catch (const system_error& e) { - // Make sure that the error denotes errno portable code. + // Re-throw system_error as ios::failure, preserving the error category + // and description. // - assert (e.code ().category () == generic_category ()); + int v (e.code ().value ()); + const error_category& c (e.code ().category ()); - throw_generic_ios_failure (e.code ().value ()); + if (c == generic_category ()) + throw_generic_ios_failure (v); + else + { + assert (c == system_category ()); + throw_system_ios_failure (v, e.what ()); + } } } -- cgit v1.1