aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix/Path.inc
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-07-05 18:55:31 +0000
committerChad Rosier <mcrosier@apple.com>2011-07-05 18:55:31 +0000
commit338398a288cde58e30fa8a12d219f417ad13ee65 (patch)
treebc8dd0e2664aa07ee49363551109bba0a8b606ae /lib/Support/Unix/Path.inc
parent549019792a8b14500cab093ac8f3c5f7331e86d7 (diff)
By default mkstemp() creates a temporary file with mode 0600, but the mode
used for open is 0666. Therefore, add the necessary permission bits for consistency. rdar://8621462 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix/Path.inc')
-rw-r--r--lib/Support/Unix/Path.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 430cf2ed8e..f295b92e4a 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -842,6 +842,9 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
// Save the name
path = FNBuffer;
+
+ // By default mkstemp sets the mode to 0600, so update mode bits now.
+ AddPermissionBits (*this, 0666);
#elif defined(HAVE_MKTEMP)
// If we don't have mkstemp, use the old and obsolete mktemp function.
if (mktemp(FNBuffer) == 0)