This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: [ranty@atdot.org: Bug#76242: libc6: broken pthread.h]


On Sat, 4 Nov 2000, Ben Collins wrote:

> Date: Sat, 4 Nov 2000 15:14:46 -0500
> From: Ben Collins <bcollins@debian.org>
> To: libc-alpha@sourceware.cygnus.com
> Subject: [ranty@atdot.org: Bug#76242: libc6: broken pthread.h]
> 
> Still exists in 2.1.97...
> 
> ----- Forwarded message from ranty@atdot.org -----

[ snip ]

> There is a typo in pthread.h
> this patch fixes it:

[ snip ]

>  #define pthread_cleanup_push(routine,arg) \
>    { struct _pthread_cleanup_buffer _buffer;				      \
> -    _pthread_cleanup_push (&_buffer, (routine), (arg));
> +    _pthread_cleanup_push (&_buffer, (routine), (arg));}

Heh, Ulrich will have a good laugh over this ``fix'', as I'm having now. :)

The whole point of pthread_cleanup_push is to open a statement block, which is
closed by the matching pthread_cleanup_pop. So the error, I imagine, must be in
some program written by ranty@atdot.org, which likely does not have proper
nesting of pushes and pops.

The above fix will cause undefined behavior, because the auto variable _buffer
is pushed onto the cleanup stack, and then it is destroyed when the statement
block terminates. Definitely not the kind of thing you want glibc to be doing!

:)


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