mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
Update.
2001-04-11 Ulrich Drepper <drepper@redhat.com> * cancel.c (_pthread_cleanup_push): Catch invalid __prev buffer and remove it. (_pthread_cleanup_push_defer): Likewise. * tst-cancel.c (main): Fix loop printing cleanup output.
This commit is contained in:
parent
8ee3551551
commit
95fe9d959f
@ -1,3 +1,11 @@
|
||||
2001-04-11 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* cancel.c (_pthread_cleanup_push): Catch invalid __prev buffer
|
||||
and remove it.
|
||||
(_pthread_cleanup_push_defer): Likewise.
|
||||
|
||||
* tst-cancel.c (main): Fix loop printing cleanup output.
|
||||
|
||||
2001-04-10 kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||
|
||||
* sysdeps/sh/pspinlock.c (__pthread_spin_lock): Fix a reverse
|
||||
|
@ -125,6 +125,18 @@ void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
|
||||
buffer->__routine = routine;
|
||||
buffer->__arg = arg;
|
||||
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
|
||||
if (buffer->__prev != NULL)
|
||||
{
|
||||
#if _STACK_GROWS_DOWN
|
||||
if ((char *) buffer >= (char *) buffer->__prev)
|
||||
buffer->__prev = NULL;
|
||||
#elif _STACK_GROWS_UP
|
||||
if ((char *) buffer <= (char *) buffer->__prev)
|
||||
buffer->__prev = NULL;
|
||||
#else
|
||||
# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
|
||||
#endif
|
||||
}
|
||||
THREAD_SETMEM(self, p_cleanup, buffer);
|
||||
}
|
||||
|
||||
@ -144,6 +156,16 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
|
||||
buffer->__arg = arg;
|
||||
buffer->__canceltype = THREAD_GETMEM(self, p_canceltype);
|
||||
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
|
||||
if (buffer->__prev != NULL)
|
||||
{
|
||||
#if _STACK_GROWS_DOWN
|
||||
if ((char *) buffer >= (char *) buffer->__prev)
|
||||
buffer->__prev = NULL;
|
||||
#elif _STACK_GROWS_UP
|
||||
if ((char *) buffer <= (char *) buffer->__prev)
|
||||
buffer->__prev = NULL;
|
||||
#endif
|
||||
}
|
||||
THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
|
||||
THREAD_SETMEM(self, p_cleanup, buffer);
|
||||
}
|
||||
@ -174,8 +196,6 @@ void __pthread_perform_cleanup(char *currentframe)
|
||||
#elif _STACK_GROWS_UP
|
||||
if ((char *) c >= currentframe)
|
||||
break;
|
||||
#else
|
||||
# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
|
||||
#endif
|
||||
c->__routine(c->__arg);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ main (void)
|
||||
while (1)
|
||||
{
|
||||
ssize_t n = read (fd, buf, sizeof buf);
|
||||
if (n < 0)
|
||||
if (n <= 0)
|
||||
break;
|
||||
write (STDOUT_FILENO, buf, n);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user