[PATCH v3] malloc: Add realloc test.

Will Newton will.newton@gmail.com
Thu Mar 26 15:48:00 GMT 2015


On Thu, Mar 26, 2015 at 3:25 PM, Andreas Schwab <schwab@suse.de> wrote:
> Will Newton <will.newton@linaro.org> writes:
>
>> +  p = realloc (NULL, 10);
>> +  save = errno;
>> +
>> +  if (p == NULL)
>> +    merror ("realloc (NULL, 10) failed.");
>> +
>> +  /* errno should be clear on success (POSIX).  */
>> +  if (p != NULL && save != 0)
>> +    merror ("errno is set but should not be");
>
> Where does it say that?

As far as I can tell POSIX doesn't, I think that's a bug. Although
whether we should ensure glibc's implementation of realloc behaves
this way or not is another matter.



More information about the Libc-alpha mailing list