aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/src/c++17/fs_ops.cc2
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc4
4 files changed, 6 insertions, 6 deletions
diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc
index e0b308a..61df197 100644
--- a/libstdc++-v3/src/c++17/fs_ops.cc
+++ b/libstdc++-v3/src/c++17/fs_ops.cc
@@ -897,7 +897,7 @@ fs::equivalent(const path& p1, const path& p2, error_code& ec) noexcept
return st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino;
#endif
}
- else if (!exists(s1) && !exists(s2))
+ else if (!exists(s1) || !exists(s2))
ec = std::make_error_code(std::errc::no_such_file_or_directory);
else if (err)
ec.assign(err, std::generic_category());
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index eccdae3..4d23a80 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -765,7 +765,7 @@ fs::equivalent(const path& p1, const path& p2, error_code& ec) noexcept
return false;
return st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino;
}
- else if (!exists(s1) && !exists(s2))
+ else if (!exists(s1) || !exists(s2))
ec = std::make_error_code(std::errc::no_such_file_or_directory);
else if (err)
ec.assign(err, std::generic_category());
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc
index 78f6e36..68f3236 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc
@@ -34,13 +34,13 @@ test01()
bool result;
result = equivalent(p1, p2, ec);
- VERIFY( ec );
+ VERIFY( ec == std::errc::no_such_file_or_directory );
VERIFY( !result );
__gnu_test::scoped_file f1(p1);
ec = bad_ec;
result = equivalent(p1, p2, ec);
- VERIFY( !ec );
+ VERIFY( ec == std::errc::no_such_file_or_directory );
VERIFY( !result );
__gnu_test::scoped_file f2(p2);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc
index 929a6ca..5bc477a 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc
@@ -35,13 +35,13 @@ test01()
bool result;
result = equivalent(p1, p2, ec);
- VERIFY( ec );
+ VERIFY( ec == std::errc::no_such_file_or_directory );
VERIFY( !result );
const auto bad_ec = ec;
__gnu_test::scoped_file f1(p1);
result = equivalent(p1, p2, ec);
- VERIFY( !ec );
+ VERIFY( ec == std::errc::no_such_file_or_directory );
VERIFY( !result );
__gnu_test::scoped_file f2(p2);