Create files with mode 666. This matches the behavior of other unix tools.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 16 Jul 2013 14:10:07 +0000 (14:10 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 16 Jul 2013 14:10:07 +0000 (14:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186414 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/raw_ostream.cpp
test/Other/umask.ll [new file with mode: 0644]

index 926294535838cec2826bb0e30f7ca96283d4d030..7609b916fbacd6cf446ee49c9b345f131e2e9712 100644 (file)
@@ -461,7 +461,7 @@ raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
   if (Flags & F_Excl)
     OpenFlags |= O_EXCL;
 
-  while ((FD = open(Filename, OpenFlags, 0664)) < 0) {
+  while ((FD = open(Filename, OpenFlags, 0666)) < 0) {
     if (errno != EINTR) {
       ErrorInfo = "Error opening output file '" + std::string(Filename) + "'";
       ShouldClose = false;
diff --git a/test/Other/umask.ll b/test/Other/umask.ll
new file mode 100644 (file)
index 0000000..37f379d
--- /dev/null
@@ -0,0 +1,13 @@
+; REQUIRES: shell
+
+; RUN: umask 000
+; RUN: rm -f %t.000
+; RUN: llvm-as %s -o %t.000
+; RUN: ls -l %t.000 | FileCheck --check-prefix=CHECK000 %s
+; CHECK000: rw-rw-rw
+
+; RUN: umask 002
+; RUN: rm -f %t.002
+; RUN: llvm-as %s -o %t.002
+; RUN: ls -l %t.002 | FileCheck --check-prefix=CHECK002 %s
+; CHECK002: rw-rw-r-