$NetBSD: patch-au,v 1.2 2014/06/20 05:24:32 jnemeth Exp $ --- sendmail/main.c.orig 2014-05-16 20:40:15.000000000 +0000 +++ sendmail/main.c @@ -148,6 +148,10 @@ int SyslogPrefixLen; /* estimated lengt } \ } +#if NAMED_BIND +struct __res_state sm_res; +#endif + int main(argc, argv, envp) int argc; @@ -210,6 +214,15 @@ main(argc, argv, envp) envp = environ; #endif /* USE_ENVIRON */ +#if NAMED_BIND +# if NAMED_RESN + sm_res = *(struct __res_state *)sm_malloc(sizeof(struct __res_state)); + memset(&sm_res, 0, sizeof(struct __res_state)); +# else + sm_res = _res; +# endif +#endif + /* turn off profiling */ SM_PROF(0); @@ -683,21 +696,25 @@ main(argc, argv, envp) */ #if NAMED_BIND - if (!bitset(RES_INIT, _res.options)) + if (!bitset(RES_INIT, sm_res.options)) +# if NAMED_RESN + (void) res_ninit(&sm_res); +# else (void) res_init(); +# endif if (tTd(8, 8)) - _res.options |= RES_DEBUG; + sm_res.options |= RES_DEBUG; else - _res.options &= ~RES_DEBUG; + sm_res.options &= ~RES_DEBUG; # ifdef RES_NOALIASES - _res.options |= RES_NOALIASES; + sm_res.options |= RES_NOALIASES; # endif /* RES_NOALIASES */ - TimeOuts.res_retry[RES_TO_DEFAULT] = _res.retry; - TimeOuts.res_retry[RES_TO_FIRST] = _res.retry; - TimeOuts.res_retry[RES_TO_NORMAL] = _res.retry; - TimeOuts.res_retrans[RES_TO_DEFAULT] = _res.retrans; - TimeOuts.res_retrans[RES_TO_FIRST] = _res.retrans; - TimeOuts.res_retrans[RES_TO_NORMAL] = _res.retrans; + TimeOuts.res_retry[RES_TO_DEFAULT] = sm_res.retry; + TimeOuts.res_retry[RES_TO_FIRST] = sm_res.retry; + TimeOuts.res_retry[RES_TO_NORMAL] = sm_res.retry; + TimeOuts.res_retrans[RES_TO_DEFAULT] = sm_res.retrans; + TimeOuts.res_retrans[RES_TO_FIRST] = sm_res.retrans; + TimeOuts.res_retrans[RES_TO_NORMAL] = sm_res.retrans; #endif /* NAMED_BIND */ errno = 0; @@ -1380,8 +1397,8 @@ main(argc, argv, envp) } #if NAMED_BIND - _res.retry = TimeOuts.res_retry[RES_TO_DEFAULT]; - _res.retrans = TimeOuts.res_retrans[RES_TO_DEFAULT]; + sm_res.retry = TimeOuts.res_retry[RES_TO_DEFAULT]; + sm_res.retrans = TimeOuts.res_retrans[RES_TO_DEFAULT]; #endif /* NAMED_BIND */ /* @@ -2884,8 +2901,8 @@ main(argc, argv, envp) sm_getla(); GrabTo = false; #if NAMED_BIND - _res.retry = TimeOuts.res_retry[RES_TO_FIRST]; - _res.retrans = TimeOuts.res_retrans[RES_TO_FIRST]; + sm_res.retry = TimeOuts.res_retry[RES_TO_FIRST]; + sm_res.retrans = TimeOuts.res_retrans[RES_TO_FIRST]; #endif /* NAMED_BIND */ next = e->e_sibling; e->e_sibling = NULL;