X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fprocess%2Ffork.c;h=a8bdbe0b03833cd763a0ad661de90d6d8d295dd2;hp=a04e8929a70e10ce7e32e3e44834ebb9ab51e049;hb=599f97360389911c293e0ca4c5eb49e007377fba;hpb=870cc679771f776333953b2a990a107393d9d0fd diff --git a/src/process/fork.c b/src/process/fork.c index a04e8929..a8bdbe0b 100644 --- a/src/process/fork.c +++ b/src/process/fork.c @@ -3,17 +3,24 @@ #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(); self->tid = self->pid = syscall(SYS_getpid); + memset(&self->robust_list, 0, sizeof self->robust_list); libc.threads_minus_1 = 0; libc.main_thread = self; } - if (libc.fork_handler) libc.fork_handler(!ret); + __fork_handler(!ret); return ret; }