From: Ulrich Drepper Date: Thu, 11 Jul 2002 09:20:52 +0000 (+0000) Subject: (_res_hconf_init): Move code into new function do_init. Use __libc_once. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe98768f9053a95e2115bcfb59d1fc39a75a8158;p=thirdparty%2Fglibc.git (_res_hconf_init): Move code into new function do_init. Use __libc_once. (do_init): New function. --- diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index b8137990ff1..e6faa6855ed 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger (davidm@azstarnet.com). @@ -411,19 +411,14 @@ parse_line (const char *fname, int line_num, const char *str) } -/* Initialize hconf datastructure by reading host.conf file and - environment variables. */ -void -_res_hconf_init (void) +static void +do_init (void) { const char *hconf_name; int line_num = 0; char buf[256], *envval; FILE *fp; - if (_res_hconf.initialized) - return; - memset (&_res_hconf, '\0', sizeof (_res_hconf)); hconf_name = getenv (ENV_HOSTCONF); @@ -482,6 +477,17 @@ _res_hconf_init (void) } +/* Initialize hconf datastructure by reading host.conf file and + environment variables. */ +void +_res_hconf_init (void) +{ + __libc_once_define (static, once); + + __libc_once (once, do_init); +} + + /* List of known interfaces. */ static struct netaddr {