From 200c748a8643cd127271f4d6849da1e147d4442f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 5 Jul 2013 21:01:08 +0000 Subject: Add a createUniqueFile function and switch llvm's users of unique_file. This function is complementary to createTemporaryFile. It handles the case were the unique file is *not* temporary: we will rename it in the end. Since we will rename it, the file has to be in the same filesystem as the final destination and we don't prepend the system temporary directory. This has a small semantic difference from unique_file: the default mode is 0666. This matches the behavior of most unix tools. For example, with this change lld now produces files with the same permissions as ld. I will add a test of this change when I port clang over to createUniqueFile (next commit). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185726 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-ar/ArchiveWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/llvm-ar') diff --git a/tools/llvm-ar/ArchiveWriter.cpp b/tools/llvm-ar/ArchiveWriter.cpp index 048748a..52ce045 100644 --- a/tools/llvm-ar/ArchiveWriter.cpp +++ b/tools/llvm-ar/ArchiveWriter.cpp @@ -260,8 +260,8 @@ bool Archive::writeToDisk(bool TruncateNames, std::string *ErrMsg) { // Create a temporary file to store the archive in int TmpArchiveFD; SmallString<128> TmpArchive; - error_code EC = sys::fs::unique_file("temp-archive-%%%%%%%.a", TmpArchiveFD, - TmpArchive, true, sys::fs::all_read | sys::fs::all_write); + error_code EC = sys::fs::createUniqueFile("temp-archive-%%%%%%%.a", + TmpArchiveFD, TmpArchive); if (EC) return true; -- cgit v1.1