[PATCH] D39778: Remove a given file even if openFileForRead fails.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 20:23:33 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317663: Remove a given file even if openFileForRead fails. (authored by ruiu).
Changed prior to commit:
https://reviews.llvm.org/D39778?vs=122025&id=122029#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39778
Files:
lld/trunk/ELF/Filesystem.cpp
Index: lld/trunk/ELF/Filesystem.cpp
===================================================================
--- lld/trunk/ELF/Filesystem.cpp
+++ lld/trunk/ELF/Filesystem.cpp
@@ -56,13 +56,12 @@
// Instead we open the file and unlink it on this thread. The unlink is fast
// since the open fd guarantees that it is not removing the last reference.
int FD;
- if (sys::fs::openFileForRead(Path, FD))
- return;
-
+ std::error_code EC = sys::fs::openFileForRead(Path, FD);
sys::fs::remove(Path);
// close and therefore remove TempPath in background.
- std::thread([=] { ::close(FD); }).detach();
+ if (!EC)
+ std::thread([=] { ::close(FD); }).detach();
#endif
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39778.122029.patch
Type: text/x-patch
Size: 684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171108/b727233f/attachment.bin>
More information about the llvm-commits
mailing list