Add 'mode' parameter when using 'O_CREAT'. Thanks to Evgeniy for pointing this out.

llvm-svn: 182598
This commit is contained in:
Bill Wendling 2013-05-23 18:08:22 +00:00
parent 5bd0b9e53b
commit a600457cde
1 changed files with 3 additions and 2 deletions

View File

@ -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);