-// Copyright (C) 2019-2021 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
inline bool
Stat::same_inode_as(const Stat& other) const
{
- return device() == other.device() && inode() == other.inode();
+ return m_errno == 0 && device() == other.device() && inode() == other.inode();
}
inline int
-// Copyright (C) 2019-2021 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
Util::write_file("a", "change size");
auto new_a_stat = Stat::stat("a");
CHECK(new_a_stat.same_inode_as(a_stat));
+
+ CHECK(!Stat::stat("nonexistent").same_inode_as(Stat::stat("nonexistent")));
}
TEST_CASE("Return values when file is missing")