toolchain/uClibc: push an upstream fix
[openwrt/staging/chunkeey.git] / toolchain / uClibc / patches-0.9.31 / 000-upstream_initialize_stdio_locking.patch
1 From d4ede2b0a4727c1f5236dd9308f09cbf7a39761a Mon Sep 17 00:00:00 2001
2 From: Timo Teräs <timo.teras@iki.fi>
3 Date: Tue, 13 Apr 2010 06:38:59 +0000
4 Subject: linuxthreads.new: initialize stdio locking
5
6 uClibc requires the threading library to enable locking for
7 stdio, or the locking is not done at all.
8
9 Signed-off-by: Timo Teräs <timo.teras@iki.fi>
10 Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
11 ---
12 diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
13 index 6ae9a10..614cad1 100644
14 --- a/libpthread/linuxthreads/pthread.c
15 +++ b/libpthread/linuxthreads/pthread.c
16 @@ -613,6 +613,17 @@ static void pthread_initialize(void)
17 #ifdef USE_TLS
18 GL(dl_init_static_tls) = &__pthread_init_static_tls;
19 #endif
20 +
21 + /* uClibc-specific stdio initialization for threads. */
22 + {
23 + FILE *fp;
24 + _stdio_user_locking = 0; /* 2 if threading not initialized */
25 + for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) {
26 + if (fp->__user_locking != 1) {
27 + fp->__user_locking = 0;
28 + }
29 + }
30 + }
31 }
32
33 void __pthread_initialize(void)