projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
getaddrinfo: add EAI_NODATA error code to distinguish NODATA vs NxDomain
[musl]
/
src
/
ldso
/
dlerror.c
diff --git
a/src/ldso/dlerror.c
b/src/ldso/dlerror.c
index
3fcc777
..
afe5925
100644
(file)
--- a/
src/ldso/dlerror.c
+++ b/
src/ldso/dlerror.c
@@
-4,6
+4,12
@@
#include "pthread_impl.h"
#include "dynlink.h"
#include "lock.h"
#include "pthread_impl.h"
#include "dynlink.h"
#include "lock.h"
+#include "fork_impl.h"
+
+#define malloc __libc_malloc
+#define calloc __libc_calloc
+#define realloc __libc_realloc
+#define free __libc_free
char *dlerror()
{
char *dlerror()
{
@@
-19,6
+25,7
@@
char *dlerror()
static volatile int freebuf_queue_lock[1];
static void **freebuf_queue;
static volatile int freebuf_queue_lock[1];
static void **freebuf_queue;
+volatile int *const __dlerror_lockptr = freebuf_queue_lock;
void __dl_thread_cleanup(void)
{
void __dl_thread_cleanup(void)
{
@@
-35,13
+42,16
@@
void __dl_thread_cleanup(void)
hidden void __dl_vseterr(const char *fmt, va_list ap)
{
LOCK(freebuf_queue_lock);
hidden void __dl_vseterr(const char *fmt, va_list ap)
{
LOCK(freebuf_queue_lock);
- while (freebuf_queue) {
- void **p = freebuf_queue;
- freebuf_queue = *p;
- free(p);
- }
+ void **q = freebuf_queue;
+ freebuf_queue = 0;
UNLOCK(freebuf_queue_lock);
UNLOCK(freebuf_queue_lock);
+ while (q) {
+ void **p = *q;
+ free(q);
+ q = p;
+ }
+
va_list ap2;
va_copy(ap2, ap);
pthread_t self = __pthread_self();
va_list ap2;
va_copy(ap2, ap);
pthread_t self = __pthread_self();