[PATCH] D57960: [Support] Fix TempFile::discard to not leave behind temporary files
Andrew Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 02:42:37 PST 2019
andrewng updated this revision to Diff 186204.
andrewng edited the summary of this revision.
andrewng added a comment.
As suggested, I have switched back to what was my original change to fix this issue.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57960/new/
https://reviews.llvm.org/D57960
Files:
lib/Support/Path.cpp
Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp
+++ lib/Support/Path.cpp
@@ -1128,6 +1128,12 @@
Error TempFile::discard() {
Done = true;
+ if (FD != -1 && close(FD) == -1) {
+ std::error_code EC = std::error_code(errno, std::generic_category());
+ return errorCodeToError(EC);
+ }
+ FD = -1;
+
std::error_code RemoveEC;
// On windows closing will remove the file.
#ifndef _WIN32
@@ -1141,12 +1147,6 @@
if (!RemoveEC)
TmpName = "";
- if (FD != -1 && close(FD) == -1) {
- std::error_code EC = std::error_code(errno, std::generic_category());
- return errorCodeToError(EC);
- }
- FD = -1;
-
return errorCodeToError(RemoveEC);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57960.186204.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/894d58d1/attachment-0001.bin>
More information about the llvm-commits
mailing list