about summary refs log tree commit diff
path: root/src/process/fork.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/process/fork.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/process/fork.c')
-rw-r--r--src/process/fork.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/process/fork.c b/src/process/fork.c
index 7530ff93..a8bdbe0b 100644
--- a/src/process/fork.c
+++ b/src/process/fork.c
@@ -3,10 +3,16 @@
 #include "libc.h"
 #include "pthread_impl.h"
 
+static void dummy(int x)
+{
+}
+
+weak_alias(dummy, __fork_handler);
+
 pid_t fork(void)
 {
 	pid_t ret;
-	if (libc.fork_handler) libc.fork_handler(-1);
+	__fork_handler(-1);
 	ret = syscall(SYS_fork);
 	if (libc.main_thread && !ret) {
 		pthread_t self = __pthread_self();
@@ -15,6 +21,6 @@ pid_t fork(void)
 		libc.threads_minus_1 = 0;
 		libc.main_thread = self;
 	}
-	if (libc.fork_handler) libc.fork_handler(!ret);
+	__fork_handler(!ret);
 	return ret;
 }