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

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 04:51:59 PDT 2018


> ================
> 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.

It took me quite some time building current trunk due to various new
problems...

The OpenFile signature changed in r232936:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150323/267202.html

The Solaris Sanitizer port started in the GCC tree quite some time ago,
and obviously I missed adapting the OpenFile implementation in
sanitizer_solaris.cc to the changed signature when forward-porting to
the LLVM tree.  AFAICS the sanitizer_posix.cc implementation is
perfectly fine even for Solaris, so the old one can just go.

I'll prepare a patch.


More information about the llvm-commits mailing list