summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-05-29 21:59:09 +0000
committerdim <dim@FreeBSD.org>2012-05-29 21:59:09 +0000
commitf040760302ef6a1b1c14ae3e951e22abe443e08f (patch)
tree12014da887ddbaddee1e78c4b43cc23a2f9afedc /contrib/llvm/lib/Support/Unix/PathV2.inc
parent3d7265cd8102879c148defab187a106d71ed3b6d (diff)
downloadFreeBSD-src-f040760302ef6a1b1c14ae3e951e22abe443e08f.zip
FreeBSD-src-f040760302ef6a1b1c14ae3e951e22abe443e08f.tar.gz
Pull in r156591 from upstream llvm trunk:
Allow unique_file to take a mode for file permissions, but default to user only read/write. and r156592 from upstream clang trunk: For final output files create them with mode 0664 to match other compilers and expected defaults. This should fix clang creating files with mode 0600. Reported by: James <james@hicag.org> MFC after: 3 days
Diffstat (limited to 'contrib/llvm/lib/Support/Unix/PathV2.inc')
-rw-r--r--contrib/llvm/lib/Support/Unix/PathV2.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/llvm/lib/Support/Unix/PathV2.inc b/contrib/llvm/lib/Support/Unix/PathV2.inc
index edb101e..38a5fe2 100644
--- a/contrib/llvm/lib/Support/Unix/PathV2.inc
+++ b/contrib/llvm/lib/Support/Unix/PathV2.inc
@@ -346,9 +346,10 @@ error_code status(const Twine &path, file_status &result) {
return error_code::success();
}
+// Since this is most often used for temporary files, mode defaults to 0600.
error_code unique_file(const Twine &model, int &result_fd,
- SmallVectorImpl<char> &result_path,
- bool makeAbsolute) {
+ SmallVectorImpl<char> &result_path,
+ bool makeAbsolute, unsigned mode) {
SmallString<128> Model;
model.toVector(Model);
// Null terminate.
@@ -395,7 +396,7 @@ retry_random_path:
// Try to open + create the file.
rety_open_create:
- int RandomFD = ::open(RandomPath.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
+ int RandomFD = ::open(RandomPath.c_str(), O_RDWR | O_CREAT | O_EXCL, mode);
if (RandomFD == -1) {
// If the file existed, try again, otherwise, error.
if (errno == errc::file_exists)
OpenPOWER on IntegriCloud