[ranty@atdot.org: Bug#76242: libc6: broken pthread.h]
Kaz Kylheku
kaz@ashi.footprints.net
Sat Nov 4 12:50:00 GMT 2000
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!
:)
More information about the Libc-alpha
mailing list