[PATCH] D48250: [sanitizer_common] Use O_TRUNC for WrOnly access mode.
Fāng-ruì Sòng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 22 12:56:30 PDT 2018
On 2018-06-21, Rainer Orth wrote:
>> ================
>> 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.
Nice to learn sanitizer_solaris.cc can be merged into sanitizer_posix.cc
Also bring to your attention that
#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
SANITIZER_OPENBSD || SANITIZER_SOLARIS
in sanitizer_linux.cc looks strange :)
--
宋方睿
More information about the llvm-commits
mailing list