From a8e76cbe147263a58d9e70e426d295858f9cd308 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 10 Mar 2009 14:42:54 +0000 Subject: resolver: res_query: do not unconditionally set h_errno to TRY_AGAIN (closes bug 173). cleanups: s/__dn_expand/dn_expand/, remove superfluous dn_expand declaration, remove libc_hidden_proto junk --- libc/inet/resolv.c | 70 ++++++------------------------------------------------ 1 file changed, 7 insertions(+), 63 deletions(-) (limited to 'libc') diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 938fd8ca8..a8dace7ce 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* resolv.c: DNS Resolver * * Copyright (C) 1998 Kenneth Albanowski , @@ -173,61 +174,6 @@ # define USE_SELECT #endif -/* Experimentally off - libc_hidden_proto(memcpy) */ -/* Experimentally off - libc_hidden_proto(memset) */ -/* Experimentally off - libc_hidden_proto(memmove) */ -/* Experimentally off - libc_hidden_proto(strchr) */ -/* Experimentally off - libc_hidden_proto(strcmp) */ -/* Experimentally off - libc_hidden_proto(strcpy) */ -/* Experimentally off - libc_hidden_proto(strdup) */ -/* Experimentally off - libc_hidden_proto(strlen) */ -/* Experimentally off - libc_hidden_proto(strncat) */ -/* Experimentally off - libc_hidden_proto(strncpy) */ -/* libc_hidden_proto(strnlen) */ -/* Experimentally off - libc_hidden_proto(strstr) */ -/* Experimentally off - libc_hidden_proto(strcasecmp) */ -/* libc_hidden_proto(socket) */ -/* libc_hidden_proto(close) */ -/* libc_hidden_proto(fopen) */ -/* libc_hidden_proto(fclose) */ -/* libc_hidden_proto(random) */ -/* libc_hidden_proto(getservbyport) */ -/* libc_hidden_proto(gethostname) */ -/* libc_hidden_proto(uname) */ -/* libc_hidden_proto(inet_addr) */ -/* libc_hidden_proto(inet_aton) */ -/* libc_hidden_proto(inet_pton) */ -/* libc_hidden_proto(inet_ntop) */ -/* libc_hidden_proto(connect) */ -/* libc_hidden_proto(poll) */ -/* libc_hidden_proto(select) */ -/* libc_hidden_proto(recv) */ -/* libc_hidden_proto(send) */ -/* libc_hidden_proto(printf) */ -/* libc_hidden_proto(sprintf) */ -/* libc_hidden_proto(snprintf) */ -/* libc_hidden_proto(fgets) */ -/* libc_hidden_proto(getnameinfo) */ -/* libc_hidden_proto(gethostbyname) */ -/* libc_hidden_proto(gethostbyname_r) */ -/* libc_hidden_proto(gethostbyname2_r) */ -/* libc_hidden_proto(gethostbyaddr) */ -/* libc_hidden_proto(gethostbyaddr_r) */ -/* libc_hidden_proto(ns_name_uncompress) */ -/* libc_hidden_proto(ns_name_unpack) */ -/* libc_hidden_proto(ns_name_ntop) */ -/* libc_hidden_proto(res_init) */ -/* libc_hidden_proto(res_query) */ -/* libc_hidden_proto(res_querydomain) */ -/* libc_hidden_proto(gethostent_r) */ -/* libc_hidden_proto(fprintf) */ -/* libc_hidden_proto(__h_errno_location) */ -#ifdef __UCLIBC_HAS_XLOCALE__ -/* libc_hidden_proto(__ctype_b_loc) */ -#elif defined __UCLIBC_HAS_CTYPE_TABLES__ -/* libc_hidden_proto(__ctype_b) */ -#endif - #if defined __UCLIBC_HAS_IPV4__ && defined __UCLIBC_HAS_IPV6__ #define IF_HAS_BOTH(...) __VA_ARGS__ #else @@ -364,8 +310,6 @@ extern int __decode_answer(const unsigned char * message, int offset, extern int __length_question(const unsigned char * const message, int offset) attribute_hidden; extern void __open_nameservers(void) attribute_hidden; extern void __close_nameservers(void) attribute_hidden; -extern int __dn_expand(const u_char *, const u_char *, const u_char *, - char *, int); /* * Theory of operation. @@ -2485,7 +2429,7 @@ libc_hidden_def(gethostbyaddr) * 'exp_dn' is a pointer to a buffer of size 'length' for the result. * Return size of compressed name or -1 if there was an error. */ -int __dn_expand(const u_char *msg, const u_char *eom, const u_char *src, +int dn_expand(const u_char *msg, const u_char *eom, const u_char *src, char *dst, int dstsiz) { int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz); @@ -2875,7 +2819,8 @@ int res_query(const char *dname, int class, int type, i = __dns_lookup(dname, type, &packet, &a); if (i < 0) { - h_errno = TRY_AGAIN; + if (!h_errno) /* TODO: can this ever happen? */ + h_errno = TRY_AGAIN; return -1; } @@ -3107,10 +3052,9 @@ int res_querydomain(const char *name, const char *domain, int class, int type, return res_query(longname, class, type, answer, anslen); } libc_hidden_def(res_querydomain) +#endif + +/* Unimplemented: */ /* res_mkquery */ /* res_send */ /* dn_comp */ -/* dn_expand */ -#endif - -/* vi: set sw=4 ts=4: */ -- cgit v1.2.3