1 --- a/libc/inet/resolv.c
2 +++ b/libc/inet/resolv.c
10 + return 0xffff & getpid();
13 +/* Our res_init never fails (always returns 0) */
18 + * These three fields used to be statically initialized. This made
19 + * it hard to use this code in a shared library. It is necessary,
20 + * now that we're doing dynamic initialization here, that we preserve
21 + * the old semantics: if an application modifies one of these three
22 + * fields of _res before res_init() is called, res_init() will not
23 + * alter them. Of course, if an application is setting them to
24 + * _zero_ before calling res_init(), hoping to override what used
25 + * to be the static default, we can't detect it and unexpected results
26 + * will follow. Zero for any of these fields would make no sense,
27 + * so one can safely assume that the applications were already getting
28 + * unexpected results.
30 + * _res.options is tricky since some apps were known to diddle the bits
31 + * before res_init() was first called. We can't replicate that semantic
32 + * with dynamic initialization (they may have turned bits off that are
33 + * set in RES_DEFAULT). Our solution is to declare such applications
34 + * "broken". They could fool us by setting RES_INIT but none do (yet).
37 + __UCLIBC_MUTEX_LOCK(__resolv_lock);
40 + _res.retrans = RES_TIMEOUT;
43 + if (!(_res.options & RES_INIT))
44 + _res.options = RES_DEFAULT;
47 + * This one used to initialize implicitly to zero, so unless the app
48 + * has set it to something in particular, we can randomize it now.
51 + _res.id = res_randomid();
53 + __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
55 + __res_vinit(&_res, 1);
56 + __res_sync = res_sync_func;
60 +libc_hidden_def(res_init)
65 @@ -3608,61 +3663,6 @@
67 #endif /* !__UCLIBC_HAS_THREADS__ */
72 - return 0xffff & getpid();
75 -/* Our res_init never fails (always returns 0) */
80 - * These three fields used to be statically initialized. This made
81 - * it hard to use this code in a shared library. It is necessary,
82 - * now that we're doing dynamic initialization here, that we preserve
83 - * the old semantics: if an application modifies one of these three
84 - * fields of _res before res_init() is called, res_init() will not
85 - * alter them. Of course, if an application is setting them to
86 - * _zero_ before calling res_init(), hoping to override what used
87 - * to be the static default, we can't detect it and unexpected results
88 - * will follow. Zero for any of these fields would make no sense,
89 - * so one can safely assume that the applications were already getting
90 - * unexpected results.
92 - * _res.options is tricky since some apps were known to diddle the bits
93 - * before res_init() was first called. We can't replicate that semantic
94 - * with dynamic initialization (they may have turned bits off that are
95 - * set in RES_DEFAULT). Our solution is to declare such applications
96 - * "broken". They could fool us by setting RES_INIT but none do (yet).
99 - __UCLIBC_MUTEX_LOCK(__resolv_lock);
102 - _res.retrans = RES_TIMEOUT;
105 - if (!(_res.options & RES_INIT))
106 - _res.options = RES_DEFAULT;
109 - * This one used to initialize implicitly to zero, so unless the app
110 - * has set it to something in particular, we can randomize it now.
113 - _res.id = res_randomid();
115 - __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
117 - __res_vinit(&_res, 1);
118 - __res_sync = res_sync_func;
122 -libc_hidden_def(res_init)
125 * Set up default settings. If the configuration file exist, the values
126 * there will have precedence. Otherwise, the server address is set to