clean up sloppy nested inclusion from pthread_impl.h
[musl] / src / process / fork.c
index 7530ff9..fb8a430 100644 (file)
@@ -1,12 +1,19 @@
 #include <unistd.h>
+#include <string.h>
 #include "syscall.h"
 #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 +22,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;
 }