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: [Patch] Fix return value in pthread_create


On Wed, Dec 14, 2011 at 5:00 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> If we are going to check for ENOMEM in pthread_create.c then
>> allocatestack.c should be fixed to stop checking for the same
>> condition.
>
> I gave Jeff the benefit of the doubt and was too lazy to hunt down that
> code. ?If it's checked adequately there then there's no reason for the
> change I made. ?But since it's already in, and it has the translation in
> one place instead of five, that plus your change seems ultimately better.
> Go ahead and commit it if you don't find any problems.
>
> The only potential caveat is that there is one path where we were changing
> errno as well. ?But since the other four paths don't do that, I guess it
> doesn't matter what's in errno.

Any sensible user code will continue to work e.g. if (errno).

In fact strerror(errno) is now accurately the true errno of the last
failed library call that set errno.

The only code that might now fail is:

pthread_create(...)
if (errno == EAGAIN)
...

Which would already fail in the 4 other return paths, not to mention
that errno is undefined after a function call that doesn't declare
that it sets errno.

Cheers,
Carlos.


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