diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-08-28 19:40:52 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-08-31 12:07:10 +0300 |
commit | ab080add26815ceef754c6ebaa2f2512e1f954cf (patch) | |
tree | cd93483b330d114e3427632290f368226e726996 /libbutl/fdstream.cxx | |
parent | 584e8fce074286cbf1a5bf0c79265f789c050c59 (diff) |
Fix assertion failure in path_search() on Windows
Also fix the similar potential assertion failure in fdstream.
Diffstat (limited to 'libbutl/fdstream.cxx')
-rw-r--r-- | libbutl/fdstream.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
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 ()); + } } } |