X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fprocess%2Ffork.c;h=a04e8929a70e10ce7e32e3e44834ebb9ab51e049;hb=94a0171d807dc94302d6505041fc58879c27f3bd;hp=07fb79ed4d361560e272c5f111a7e468539cfda8;hpb=e2915eeeea244d3818d5eb7532ed35c6cf43c8fd;p=musl diff --git a/src/process/fork.c b/src/process/fork.c index 07fb79ed..a04e8929 100644 --- a/src/process/fork.c +++ b/src/process/fork.c @@ -8,10 +8,11 @@ pid_t fork(void) pid_t ret; if (libc.fork_handler) libc.fork_handler(-1); ret = syscall(SYS_fork); - if (libc.lock && !ret) { + if (libc.main_thread && !ret) { pthread_t self = __pthread_self(); self->tid = self->pid = syscall(SYS_getpid); libc.threads_minus_1 = 0; + libc.main_thread = self; } if (libc.fork_handler) libc.fork_handler(!ret); return ret;