By default mkstemp() creates a temporary file with mode 0600, but the mode
authorChad Rosier <mcrosier@apple.com>
Tue, 5 Jul 2011 18:55:31 +0000 (18:55 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 5 Jul 2011 18:55:31 +0000 (18:55 +0000)
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

lib/Support/Unix/Path.inc

index 430cf2ed8e8f6ea90dcd871dcd4c07d3a298cc39..f295b92e4a5ba6ab449a6d8c42445a6ac0bea0f3 100644 (file)
@@ -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)