This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] malloc: Add realloc test.
- From: Will Newton <will dot newton at gmail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, patches at linaro dot org
- Date: Thu, 26 Mar 2015 15:48:02 +0000
- Subject: Re: [PATCH v3] malloc: Add realloc test.
- Authentication-results: sourceware.org; auth=none
- References: <521269A2 dot 7040207 at linaro dot org> <mvmoanfye5t dot fsf at hawking dot suse dot de>
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.