[PATCH] D48250: [sanitizer_common] Use O_TRUNC for WrOnly access mode.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 20:14:46 PDT 2018


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_solaris.cc:81
   return internal_open(filename,
-      write ? O_WRONLY | O_CREAT : O_RDONLY, 0660);
+      write ? O_WRONLY | O_CREAT | O_TRUNC : O_RDONLY, 0660);
 }
----------------
vitalybuka wrote:
> This function has different signature.
> 
> @krytarowski I don't see any calls to this function. Is this here accidentally?
I don't know much about the file history. But I guess the signature of `OpenFile` has changed from two parameters to three parameters at some point and the solaris version does not catch up.

```
// Returns kInvalidFd on error.
fd_t OpenFile(const char *filename, FileAccessMode mode,
              error_t *errno_p = nullptr);
```

Just reverted the change to the solaris file.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48250





More information about the llvm-commits mailing list