[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
Fri Feb 8 11:28:32 PST 2019


andrewng added a comment.

In D57960#1390773 <https://reviews.llvm.org/D57960#1390773>, @ruiu wrote:

> This class should do a minimum number of attempt to remove a file, instead of trying to remove a file at various points to increase the chance to successfully removing the file. Why don't you close the file before removing the file?


Actually, that was my first approach to fix this issue; to move the remove after the close. However, I then recalled that doing the file remove (unlink) before the close is actually the "normal" approach for POSIX (perhaps because it's more "atomic" in behaviour), so I changed to this implementation instead. But if moving the remove after the close is acceptable, I'm happy for that approach.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57960/new/

https://reviews.llvm.org/D57960





More information about the llvm-commits mailing list