Kaynağa Gözat

fix pthread_cleanup_pop(1) crash in non-thread-capable, static-linked programs

Rich Felker 13 yıl önce
ebeveyn
işleme
e3234d0109
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 0
      src/thread/cancellation.c
  2. 0 2
      src/thread/pthread_create.c

+ 2 - 0
src/thread/cancellation.c

@@ -5,6 +5,8 @@ void __do_cleanup_pop();
 
 void _pthread_cleanup_push(struct __ptcb *cb, void (*f)(void *), void *x)
 {
+	cb->__f = f;
+	cb->__x = x;
 	__do_cleanup_push(cb, f, x);
 }
 

+ 0 - 2
src/thread/pthread_create.c

@@ -46,8 +46,6 @@ void pthread_exit(void *result)
 void __do_cleanup_push(struct __ptcb *cb, void (*f)(void *), void *x)
 {
 	struct pthread *self = pthread_self();
-	cb->__f = f;
-	cb->__x = x;
 	cb->__next = self->cancelbuf;
 	self->cancelbuf = cb;
 }