From owner-freebsd-questions@FreeBSD.ORG Wed Sep 26 06:27:07 2012 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67F261065673; Wed, 26 Sep 2012 06:27:07 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 021CF8FC1B; Wed, 26 Sep 2012 06:27:05 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id q8Q6Qwd2019965; Wed, 26 Sep 2012 14:26:58 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <5062A037.7080306@FreeBSD.org> Date: Wed, 26 Sep 2012 14:27:03 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120829 Thunderbird/14.0 MIME-Version: 1.0 To: Matthew Seaman References: <20120924172911.0839be5d@scorpio> <5061494D.1000203@FreeBSD.org> In-Reply-To: <5061494D.1000203@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jerry , FreeBSD Subject: Re: Re: PR 161548 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 06:27:07 -0000 On 2012/09/25 14:03, Matthew Seaman wrote: > On 24/09/2012 22:29, Jerry wrote: >> Is there any specific reason that this PR: 161548 is still marked as >> open? >> >> o 2011/10/13 bin/161548 [patch] getent(1) inconsistent treatment of IPv6 host data > It simply hasn't attracted the attention of anyone with a src commit > bit. Yet. There's no need to declare he4 and he6 as struct hostent, the original declaration of he is fine. So here is patch. Index: usr.bin/getent/getent.c =================================================================== --- usr.bin/getent/getent.c (revision 240947) +++ usr.bin/getent/getent.c (working copy) @@ -285,6 +285,7 @@ hosts(int argc, char *argv[]) assert(argv != NULL); sethostent(1); + he = NULL; rv = RV_OK; if (argc == 2) { while ((he = gethostent()) != NULL) @@ -295,8 +296,9 @@ hosts(int argc, char *argv[]) he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6); else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0) he = gethostbyaddr(addr, INADDRSZ, AF_INET); - else - he = gethostbyname(argv[i]); + else if ((he = gethostbyname2(argv[i], AF_INET6)) == + NULL) + he = gethostbyname2(argv[i], AF_INET); if (he != NULL) hostsprint(he); else { > > Cheers, > > Matthew > Kevin