From c87eb78820da4cc07405d6f076b5c165e387e377 Mon Sep 17 00:00:00 2001 From: Eric Faurot Date: Sat, 18 Aug 2012 13:31:04 +0000 Subject: Simplify error reporting in hostaddr_async(). Only use EAI_* error codes. --- lib/libc/asr/hostaddr_async.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/asr/hostaddr_async.c b/lib/libc/asr/hostaddr_async.c index ecea827186a..f76c6b0f3d3 100644 --- a/lib/libc/asr/hostaddr_async.c +++ b/lib/libc/asr/hostaddr_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hostaddr_async.c,v 1.1 2012/04/14 09:24:18 eric Exp $ */ +/* $OpenBSD: hostaddr_async.c,v 1.2 2012/08/18 13:31:03 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -109,7 +109,6 @@ hostaddr_async_run(struct async *as, struct async_res *ar) * families with this DB. */ if (as->as_count) { - ar->ar_errno = 0; ar->ar_gai_errno = 0; async_set_state(as, ASR_STATE_HALT); } else @@ -148,8 +147,6 @@ hostaddr_async_run(struct async *as, struct async_res *ar) as->as.host.subq = res_query_async_ctx(name, C_IN, type, NULL, 0, as->as_ctx); if (as->as.host.subq == NULL) { - ar->ar_errno = errno; - ar->ar_h_errno = NETDB_INTERNAL; if (errno == ENOMEM) ar->ar_gai_errno = EAI_MEMORY; else @@ -284,18 +281,12 @@ hostaddr_async_run(struct async *as, struct async_res *ar) case ASR_STATE_NOT_FOUND: /* XXX the exact error depends on what query/send returned */ - ar->ar_errno = 0; ar->ar_gai_errno = EAI_NODATA; async_set_state(as, ASR_STATE_HALT); break; case ASR_STATE_HALT: - - ar->ar_count = as->as_count; - if (ar->ar_count) { - ar->ar_errno = 0; - ar->ar_gai_errno = 0; - } + ar->ar_count = ar->ar_gai_errno ? 0 : as->as_count; return (ASYNC_DONE); default: -- cgit v1.2.3