PR libstdc++/83626 simplify filesystem::remove and filesystem::remove_all
Backport from mainline 2018-01-05 Jonathan Wakely <jwakely@redhat.com> 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. From-SVN: r256603
This commit is contained in:
parent
ab1c0a5d9c
commit
b520d0cffb
@ -1,3 +1,13 @@
|
|||||||
|
2018-01-13 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
2018-01-05 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
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 <jwakely@redhat.com>
|
2018-01-05 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
|
@ -1274,14 +1274,6 @@ fs::remove(const path& p)
|
|||||||
bool
|
bool
|
||||||
fs::remove(const path& p, error_code& ec) noexcept
|
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)
|
if (::remove(p.c_str()) == 0)
|
||||||
{
|
{
|
||||||
ec.clear();
|
ec.clear();
|
||||||
@ -1327,14 +1319,9 @@ fs::remove_all(const path& p, error_code& ec) noexcept
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::remove(p.c_str()) == 0)
|
if (fs::remove(p, ec))
|
||||||
++count;
|
++count;
|
||||||
else if (errno != ENOENT)
|
return ec ? -1 : count;
|
||||||
{
|
|
||||||
ec.assign(errno, std::generic_category());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user