diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2013-05-27 17:31:02 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2013-05-27 17:31:02 +0000 |
commit | 595fac8a14905c9e48e876b0dfb69492af15bf6b (patch) | |
tree | 89313f5e551ef8cb78a4c587c63453f5fda9c8ed /lib/libc/asr/res_query.c | |
parent | 3db28768772e2df85e857d3071948ff3eea00f09 (diff) |
Add minimal support for _res setup and update.
Change res_init() to initialize the _res structure on first call, and
udpate the global async context if changes were made by the user. All
resolver functions now call res_init() internally.
fixes issue spotted by otto@
Diffstat (limited to 'lib/libc/asr/res_query.c')
-rw-r--r-- | lib/libc/asr/res_query.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/asr/res_query.c b/lib/libc/asr/res_query.c index 7a6a1db0ca4..c30188fae54 100644 --- a/lib/libc/asr/res_query.c +++ b/lib/libc/asr/res_query.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_query.c,v 1.3 2013/04/30 12:02:39 eric Exp $ */ +/* $OpenBSD: res_query.c,v 1.4 2013/05/27 17:31:01 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -31,6 +31,8 @@ res_query(const char *name, int class, int type, u_char *ans, int anslen) struct async_res ar; size_t len; + res_init(); + if (ans == NULL || anslen <= 0) { h_errno = NO_RECOVERY; errno = EINVAL; @@ -71,6 +73,8 @@ res_search(const char *name, int class, int type, u_char *ans, int anslen) struct async_res ar; size_t len; + res_init(); + if (ans == NULL || anslen <= 0) { h_errno = NO_RECOVERY; errno = EINVAL; |