[PATCH] D57960: [Support] Fix TempFile::discard to not leave behind temporary files

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 8 11:36:11 PST 2019


ruiu added a comment.

I think that unlinking a file while opening a file is a common way to create an unnamed temporary file. By doing that, you don't have to worry about leaving temporary files behind. However, if your temporary file can be permanent by renaming it to a permanent filename, that method is irrelevant because you can't unlink a file (if you do, your file become unnamed, and there's no POSIX-compliant way to revive unnamed file as a named one AFAIK.)

What we are trying to do here is the latter, so I think the order of removing a file and closing a file descriptor doesn't matter.


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

https://reviews.llvm.org/D57960





More information about the llvm-commits mailing list