diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 24398d84a71..c528c29620a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2018-01-13 Jonathan Wakely + + Backport from mainline + 2018-01-05 Jonathan Wakely + + PR libstdc++/83626 + * src/filesystem/ops.cc (remove(const path&, error_code&)): Remove + unnecessary symlink_status call. + (remove_all(const path&, error_code&)): Use filesystem::remove. + 2018-01-05 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index feb0a1ea84a..8de3511346e 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -1274,14 +1274,6 @@ fs::remove(const path& p) bool fs::remove(const path& p, error_code& ec) noexcept { - const auto s = symlink_status(p, ec); - if (!status_known(s)) - return false; - if (s.type() == file_type::not_found) - { - ec.clear(); - return false; // Nothing to do, not an error. - } if (::remove(p.c_str()) == 0) { ec.clear(); @@ -1327,14 +1319,9 @@ fs::remove_all(const path& p, error_code& ec) noexcept return -1; } - if (::remove(p.c_str()) == 0) + if (fs::remove(p, ec)) ++count; - else if (errno != ENOENT) - { - ec.assign(errno, std::generic_category()); - return -1; - } - return count; + return ec ? -1 : count; } void