[libcxx-commits] [libcxx] [libcxx] Correct and clean-up filesystem operations error_code paths (PR #88341)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 11 18:57:24 PDT 2024


================
@@ -166,15 +163,15 @@ void __copy(const path& from, const path& to, copy_options options, error_code*
       return;
     }
     error_code m_ec2;
-    for (; it != directory_iterator(); it.increment(m_ec2)) {
-      if (m_ec2) {
-        return err.report(m_ec2);
-      }
+    for (; !m_ec2 && it != directory_iterator(); it.increment(m_ec2)) {
----------------
ldionne wrote:

I don't understand this change. IIUC, the PR description mentions that we incorrectly forgot to check `m_ec2` after the recursive call to `__copy`, but this didn't change after your patch. We're still passing `ec` to the recursive `__copy` call (not `m_ec2`). I think I am missing something.

https://github.com/llvm/llvm-project/pull/88341


More information about the libcxx-commits mailing list