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

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 16 02:44:43 PDT 2018


krytarowski added a subscriber: ro.
krytarowski 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);
 }
----------------
MaskRay wrote:
> 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.
Hmm, CC @ro. I'm not sure about SunOS.


Repository:
  rL LLVM

https://reviews.llvm.org/D48250





More information about the llvm-commits mailing list