diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-12-28 15:06:04 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-12-28 15:06:04 +0000 |
commit | 85b4900b0d7ade7226bd63d2bc5ed4797c00148c (patch) | |
tree | 45e0201ea0a685265bcf7b925f22e254b62e2fe0 /toolchain/uClibc | |
parent | 535ac95612dffa24952a27892359efeb429ebce0 (diff) | |
download | master-187ad058-85b4900b0d7ade7226bd63d2bc5ed4797c00148c.tar.gz master-187ad058-85b4900b0d7ade7226bd63d2bc5ed4797c00148c.tar.bz2 master-187ad058-85b4900b0d7ade7226bd63d2bc5ed4797c00148c.zip |
uClibc: make res_init() thread safe
Signed-off-by: Jiri Slachta <slachta@cesnet.cz>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39178 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'toolchain/uClibc')
-rw-r--r-- | toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch new file mode 100644 index 0000000000..e23b0839ad --- /dev/null +++ b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch @@ -0,0 +1,55 @@ +--- a/libc/inet/resolv.c ++++ b/libc/inet/resolv.c +@@ -3432,6 +3432,7 @@ static void res_sync_func(void) + */ + } + ++/* has to be called under __resolv_lock */ + static int + __res_vinit(res_state rp, int preinit) + { +@@ -3440,7 +3441,6 @@ __res_vinit(res_state rp, int preinit) + int m = 0; + #endif + +- __UCLIBC_MUTEX_LOCK(__resolv_lock); + __close_nameservers(); + __open_nameservers(); + +@@ -3532,7 +3532,6 @@ __res_vinit(res_state rp, int preinit) + + rp->options |= RES_INIT; + +- __UCLIBC_MUTEX_UNLOCK(__resolv_lock); + return 0; + } + +@@ -3582,11 +3582,11 @@ res_init(void) + if (!_res.id) + _res.id = res_randomid(); + +- __UCLIBC_MUTEX_UNLOCK(__resolv_lock); +- + __res_vinit(&_res, 1); + __res_sync = res_sync_func; + ++ __UCLIBC_MUTEX_UNLOCK(__resolv_lock); ++ + return 0; + } + libc_hidden_def(res_init) +@@ -3687,7 +3687,11 @@ struct __res_state *__resp = &_res; + int + res_ninit(res_state statp) + { +- return __res_vinit(statp, 0); ++ int ret; ++ __UCLIBC_MUTEX_LOCK(__resolv_lock); ++ ret = __res_vinit(statp, 0); ++ __UCLIBC_MUTEX_UNLOCK(__resolv_lock); ++ return ret; + } + + #endif /* L_res_init */ +-- +cgit v0.9.1 |