projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
work around "signal loses thread pointer" issue with "approach 2"
[musl]
/
src
/
ldso
/
dynlink.c
diff --git
a/src/ldso/dynlink.c
b/src/ldso/dynlink.c
index
ca49f43
..
6ff8850
100644
(file)
--- a/
src/ldso/dynlink.c
+++ b/
src/ldso/dynlink.c
@@
-47,9
+47,9
@@
struct dso
size_t map_len;
dev_t dev;
ino_t ino;
size_t map_len;
dev_t dev;
ino_t ino;
-
int
global;
-
int
relocated;
-
int
constructed;
+
char
global;
+
char
relocated;
+
char
constructed;
struct dso **deps;
char *name;
char buf[];
struct dso **deps;
char *name;
char buf[];
@@
-610,9
+610,11
@@
void *dlopen(const char *file, int mode)
{
struct dso *volatile p, *orig_tail = tail, *next;
size_t i;
{
struct dso *volatile p, *orig_tail = tail, *next;
size_t i;
+ int cs;
if (!file) return head;
if (!file) return head;
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
pthread_rwlock_wrlock(&lock);
if (setjmp(rtld_fail)) {
pthread_rwlock_wrlock(&lock);
if (setjmp(rtld_fail)) {
@@
-628,8
+630,8
@@
void *dlopen(const char *file, int mode)
}
tail = orig_tail;
tail->next = 0;
}
tail = orig_tail;
tail->next = 0;
- p
thread_rwlock_unlock(&lock)
;
-
return 0
;
+ p
= 0
;
+
goto end
;
}
p = load_library(file);
}
p = load_library(file);
@@
-655,8
+657,10
@@
void *dlopen(const char *file, int mode)
p->global = 1;
}
p->global = 1;
}
+ do_init_fini(tail);
end:
pthread_rwlock_unlock(&lock);
end:
pthread_rwlock_unlock(&lock);
+ pthread_setcancelstate(cs, 0);
return p;
}
return p;
}