diff mbox

[v3] PR libstdc++/71313

Message ID CAFk2RUZy3cJmo=0Y+eyAvskdPKegq4peRvt+bi-wS7q6J_hJng@mail.gmail.com
State New
Headers show

Commit Message

Ville Voutilainen July 4, 2016, 12:31 p.m. UTC
On 4 July 2016 at 15:27, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:
> Tested on Linux-x64.
>
> 2016-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
>
>     PR libstdc++/71313
>     * src/filesystem/ops.cc (remove_all(const path&, error_code&)):
>     Call remove_all for children of a directory.
>     * testsuite/experimental/filesystem/operations/create_directories.cc:
>     Adjust.

Minor tidy-up, use std::uintmax_t in the test instead of int.

Comments

Jonathan Wakely July 4, 2016, 12:45 p.m. UTC | #1
On 04/07/16 15:31 +0300, Ville Voutilainen wrote:
>On 4 July 2016 at 15:27, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:
>> Tested on Linux-x64.
>>
>> 2016-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
>>
>>     PR libstdc++/71313
>>     * src/filesystem/ops.cc (remove_all(const path&, error_code&)):
>>     Call remove_all for children of a directory.
>>     * testsuite/experimental/filesystem/operations/create_directories.cc:
>>     Adjust.
>
>Minor tidy-up, use std::uintmax_t in the test instead of int.

OK for trunk + gcc-6-branch + gcc-5-branch, thanks.
diff mbox

Patch

diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index 67ed8e6..9fb5b639 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -1194,7 +1194,7 @@  fs::remove_all(const path& p, error_code& ec) noexcept
   uintmax_t count = 0;
   if (ec.value() == 0 && fs.type() == file_type::directory)
     for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d)
-      count += fs::remove(d->path(), ec);
+      count += fs::remove_all(d->path(), ec);
   if (ec.value())
     return -1;
   return fs::remove(p, ec) ? ++count : -1;  // fs:remove() calls ec.clear()
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
index 4be41a6..a52efe4 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc
@@ -65,7 +65,8 @@  test01()
   VERIFY( b );
   VERIFY( is_directory(p/"./d4/../d5") );
 
-  remove_all(p, ec);
+  std::uintmax_t count = remove_all(p, ec);
+  VERIFY( count == 6 );
 }
 
 int