summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-23 18:08:22 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-23 18:08:22 +0000
commit468eb10c6051c6f93df75cfc34fc98180dea1bbf (patch)
treeeb02d20842f80f7379b34be379c83f5f070023e2 /lib/profile/GCDAProfiling.c
parente850b87a9b18774385a337159c5ce1811bfc4a02 (diff)
Add 'mode' parameter when using 'O_CREAT'. Thanks to Evgeniy for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index 71dd9bd67..e58cceabf 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -229,13 +229,14 @@ void llvm_gcda_start_file(const char *orig_filename, const char version[4]) {
if (fd == -1) {
/* Try opening the file, creating it if necessary. */
+ int mode = 0644;
new_file = 1;
mode = "w+b";
- fd = open(filename, O_RDWR | O_CREAT);
+ fd = open(filename, O_RDWR | O_CREAT, mode);
if (fd == -1) {
/* Try creating the directories first then opening the file. */
recursive_mkdir(filename);
- fd = open(filename, O_RDWR | O_CREAT);
+ fd = open(filename, O_RDWR | O_CREAT, mode);
if (!output_file) {
/* Bah! It's hopeless. */
fprintf(stderr, "profiling:%s: cannot open\n", filename);