This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix BZ #18757 - fmemopen fails to set errno on failure


On Fri, Aug 14, 2015 at 12:32 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Paul Pluzhnikov <ppluzhnikov@gmail.com> writes:
>
>> @@ -196,7 +197,10 @@ _IO_fopencookie (cookie, mode, io_functions)
>>
>>    new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
>>    if (new_f == NULL)
>> -    return NULL;
>> +    {
>> +      __set_errno (ENOMEM);
>
> This will overwrite the errno set by malloc.

Thanks. Corrected patch attached.

2015-08-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

        [BZ #18757]
        * libio/iofopncook.c (_IO_fopencookie): Set errno on failure
        * libio/test-fmemopen.c (do_bz18820): Extend the test to cover BZ #18757



-- 
Paul Pluzhnikov

Attachment: bz18757-20150814.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]