[PATCH v4] ungetc: Guarantee single char pushback
Siddhesh Poyarekar
siddhesh@sourceware.org
Mon Dec 16 13:32:40 GMT 2024
On 2024-12-16 07:58, Siddhesh Poyarekar wrote:
>>> +
>>> +void *
>>> +malloc (size_t sz)
>>> +{
>>> + if (fail)
>>> + return NULL;
>>> +
>>> + return __libc_malloc (sz);
>>> +}
>>
>> OK, this interposes `malloc' so as to conditionally induce a failure
>> and
>> refers to `__libc_malloc' if the condition does not stand. A bit hackish
>> IMO, but we're in control here, so let it be.
>>
>> I think this function deserves an introductory comment, even if a
>> single
>> terse line.
>
> OK.
>
I just realized while adding the comment that the reason why I was using
__libc_malloc (which was to avoid dlsym) was a flimsy one and will in
fact end up skipping any interposed malloc implementations. It's not an
immediate problem since I don't think anybody runs the testsuite with
interposed malloc today, but I'll use dlsym anyway to be future-proof.
Sid
More information about the Libc-alpha
mailing list