[PATCH] D28470: Support outputting to /dev/null

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 13:39:43 PST 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with this fix.



================
Comment at: lib/Support/FileOutputBuffer.cpp:128
+    EC = sys::fs::rename(Twine(TempPath), Twine(FinalPath));
+    sys::DontRemoveFileOnSignal(TempPath);
+  } else {
----------------
I think I now understand why we had this code in the first place, and I believe we want to call this for both IsRegular and !IsRegular.

Once we are done with a temporary file, we rename or remove the temporary file, so the path will become nonexistent. After that, we don't want to try to remove that path, because it is useless, and sometimes harmful, if other process happens to use the same temporary filename.


https://reviews.llvm.org/D28470





More information about the llvm-commits mailing list