about summary refs log tree commit diff
path: root/src/thread/pthread_atfork.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-06 20:09:51 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-06 20:09:51 -0400
commit98acf04fc00cbded6169056f2cd541d31725c091 (patch)
treef792014c7cbc4deee8c3de9b511d9e7329f2bf0d /src/thread/pthread_atfork.c
parent338b663ddb64ecf8a62ad0d1020a29587e0ca81b (diff)
downloadmusl-98acf04fc00cbded6169056f2cd541d31725c091.tar.gz
musl-98acf04fc00cbded6169056f2cd541d31725c091.tar.xz
musl-98acf04fc00cbded6169056f2cd541d31725c091.zip
use weak aliases rather than function pointers to simplify some code
Diffstat (limited to 'src/thread/pthread_atfork.c')
-rw-r--r--src/thread/pthread_atfork.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/thread/pthread_atfork.c b/src/thread/pthread_atfork.c
index 0773dc8f..a7a82016 100644
--- a/src/thread/pthread_atfork.c
+++ b/src/thread/pthread_atfork.c
@@ -10,9 +10,10 @@ static struct atfork_funcs {
 
 static int lock;
 
-static void fork_handler(int who)
+void __fork_handler(int who)
 {
 	struct atfork_funcs *p;
+	if (!funcs) return;
 	if (who < 0) {
 		LOCK(&lock);
 		for (p=funcs; p; p = p->next) {
@@ -35,7 +36,6 @@ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(vo
 	if (!new) return -1;
 
 	LOCK(&lock);
-	libc.fork_handler = fork_handler;
 	new->next = funcs;
 	new->prev = 0;
 	new->prepare = prepare;