linamh/sys-libs/glibc/files/2.3.4/glibc-2.3.4-res_init.patch

121 lines
3.3 KiB
Diff
Raw Normal View History

2004-08-12 H.J. Lu <hongjiu.lu@intel.com>
* resolv/res_libc.c: Move definition of __res_maybe_init ...
* resolv/res_init.c: ... here.
2004-08-11 Andreas Schwab <schwab@suse.de>
* resolv/res_libc.c: Move definition of __res_initstamp ...
* resolv/res_init.c: ... here.
--- resolv/res_init.c.res_init 2004-08-11 14:23:06.000000000 -0700
+++ resolv/res_init.c 2004-08-12 16:29:09.000000000 -0700
@@ -106,6 +106,10 @@ static u_int32_t net_mask __P((struct in
# define isascii(c) (!(c & 0200))
#endif
+#ifdef _LIBC
+unsigned long long int __res_initstamp attribute_hidden;
+#endif
+
/*
* Resolver state default settings.
*/
@@ -162,7 +166,6 @@ __res_vinit(res_state statp, int preinit
int dots;
#endif
#ifdef _LIBC
- extern unsigned long long int __res_initstamp attribute_hidden;
statp->_u._ext.initstamp = __res_initstamp;
#endif
@@ -574,6 +577,39 @@ libc_hidden_def (__res_nclose)
#endif
#ifdef _LIBC
+/* Initialize resp if RES_INIT is not yet set or if res_init in some other
+ thread requested re-initializing. */
+int
+__res_maybe_init (res_state resp, int preinit)
+{
+ if (resp->options & RES_INIT) {
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0) {
+ __res_nclose (resp);
+ for (int ns = 0; ns < MAXNS; ns++) {
+ free (resp->_u._ext.nsaddrs[ns]);
+ resp->_u._ext.nsaddrs[ns] = NULL;
+ }
+ return __res_vinit (resp, 1);
+ }
+ }
+ return 0;
+ } else if (preinit) {
+ if (!resp->retrans)
+ resp->retrans = RES_TIMEOUT;
+ if (!resp->retry)
+ resp->retry = 4;
+ resp->options = RES_DEFAULT;
+ if (!resp->id)
+ resp->id = res_randomid ();
+ return __res_vinit (resp, 1);
+ } else
+ return __res_ninit (resp);
+}
+libc_hidden_def (__res_maybe_init)
+#endif
+
+#ifdef _LIBC
# ifdef _LIBC_REENTRANT
/* This is called when a thread is exiting to free resources held in _res. */
static void __attribute__ ((section ("__libc_thread_freeres_fn")))
--- resolv/res_libc.c.res_init 2004-08-11 14:23:06.000000000 -0700
+++ resolv/res_libc.c 2004-08-12 16:28:00.000000000 -0700
@@ -28,7 +28,7 @@
out) since res_init() should go into libc.so but the rest of that
file should not. */
-unsigned long long int __res_initstamp attribute_hidden;
+extern unsigned long long int __res_initstamp attribute_hidden;
/* We have atomic increment operations on 64-bit platforms. */
#if __WORDSIZE == 64
# define atomicinclock(lock) (void) 0
@@ -94,37 +94,6 @@ res_init(void) {
return (__res_vinit(&_res, 1));
}
-
-/* Initialize resp if RES_INIT is not yet set or if res_init in some other
- thread requested re-initializing. */
-int
-__res_maybe_init (res_state resp, int preinit)
-{
- if (resp->options & RES_INIT) {
- if (__res_initstamp != resp->_u._ext.initstamp) {
- if (resp->nscount > 0) {
- __res_nclose (resp);
- for (int ns = 0; ns < MAXNS; ns++) {
- free (resp->_u._ext.nsaddrs[ns]);
- resp->_u._ext.nsaddrs[ns] = NULL;
- }
- return __res_vinit (resp, 1);
- }
- }
- return 0;
- } else if (preinit) {
- if (!resp->retrans)
- resp->retrans = RES_TIMEOUT;
- if (!resp->retry)
- resp->retry = 4;
- resp->options = RES_DEFAULT;
- if (!resp->id)
- resp->id = res_randomid ();
- return __res_vinit (resp, 1);
- } else
- return __res_ninit (resp);
-}
-libc_hidden_def (__res_maybe_init)
/* This needs to be after the use of _res in res_init, above. */
#undef _res