{
struct dso *volatile p, *orig_tail = tail, *next;
size_t i;
+ int cs;
if (!file) return head;
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
pthread_rwlock_wrlock(&lock);
if (setjmp(rtld_fail)) {
}
tail = orig_tail;
tail->next = 0;
- pthread_rwlock_unlock(&lock);
- return 0;
+ p = 0;
+ goto end;
}
p = load_library(file);
do_init_fini(tail);
end:
pthread_rwlock_unlock(&lock);
+ pthread_setcancelstate(cs, 0);
return p;
}