[PATCH] D41830: [libc++] Fix PR#35780 - make std::experimental::filesystem::remove and remove_all return false or 0 if the file doesn't exist
Marshall Clow via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 9 10:53:40 PST 2018
mclow.lists added inline comments.
================
Comment at: src/experimental/filesystem/operations.cpp:666
if (::remove(p.c_str()) == -1) {
- set_or_throw(ec, "remove", p);
+ if (ec != nullptr && *ec != errc::no_such_file_or_directory)
+ set_or_throw(ec, "remove", p);
----------------
I don't think that this is correct.
In the case where ec == nullptr AND the error is not "no such file", this will fail to throw.
I think you just want this test to be:
if (errno != ENOENT)
https://reviews.llvm.org/D41830
More information about the cfe-commits
mailing list