mirror of git://gcc.gnu.org/git/gcc.git
Use non-throwing is_directory in filesystem::create_directory
The create_dir helper was calling the throwing form of filesystem::is_directory instead of passing the error_code argument. Since std::filesystem::create_directory(const path&, error_code&) is noexcept, it would call std::terminate if an error occurred in is_directory. Passing the error_code also takes care of clearing it in the case where is_directory returns true. src/filesystem/ops.cc (create_dir): Pass error_code to is_directory. src/filesystem/std-ops.cc (create_dir): Likewise. From-SVN: r258375
This commit is contained in:
parent
0bfd8ca928
commit
311735dbc6
|
|
@ -1,3 +1,8 @@
|
||||||
|
2018-03-09 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
src/filesystem/ops.cc (create_dir): Pass error_code to is_directory.
|
||||||
|
src/filesystem/std-ops.cc (create_dir): Likewise.
|
||||||
|
|
||||||
2018-03-08 François Dumont <fdumont@gcc.gnu.org>
|
2018-03-08 François Dumont <fdumont@gcc.gnu.org>
|
||||||
|
|
||||||
* python/libstdcxx/v6/printers.py (NodeIteratorPrinter): New.
|
* python/libstdcxx/v6/printers.py (NodeIteratorPrinter): New.
|
||||||
|
|
|
||||||
|
|
@ -463,10 +463,8 @@ namespace
|
||||||
if (::mkdir(p.c_str(), mode))
|
if (::mkdir(p.c_str(), mode))
|
||||||
{
|
{
|
||||||
const int err = errno;
|
const int err = errno;
|
||||||
if (err != EEXIST || !is_directory(p))
|
if (err != EEXIST || !is_directory(p, ec))
|
||||||
ec.assign(err, std::generic_category());
|
ec.assign(err, std::generic_category());
|
||||||
else
|
|
||||||
ec.clear();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -668,10 +668,8 @@ namespace
|
||||||
if (::mkdir(p.c_str(), mode))
|
if (::mkdir(p.c_str(), mode))
|
||||||
{
|
{
|
||||||
const int err = errno;
|
const int err = errno;
|
||||||
if (err != EEXIST || !is_directory(p))
|
if (err != EEXIST || !is_directory(p, ec))
|
||||||
ec.assign(err, std::generic_category());
|
ec.assign(err, std::generic_category());
|
||||||
else
|
|
||||||
ec.clear();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue