Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/lib/libc/net pullup 1.47 -> 1.48 (approved by releng-1-5)



details:   https://anonhg.NetBSD.org/src/rev/349a22722428
branches:  netbsd-1-5
changeset: 489337:349a22722428
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Aug 31 23:16:58 2000 +0000

description:
pullup 1.47 -> 1.48 (approved by releng-1-5)

 > on /etc/hosts lookup, set "official host name" (the leftmost hostname)
 > into ai_canonname.  this is to synchronize with practice in gethostby*.
 > comment from ume%mahoroba.org@localhost.  sync with kame.

diffstat:

 lib/libc/net/getaddrinfo.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 768da99afd4b -r 349a22722428 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Thu Aug 31 18:16:43 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Thu Aug 31 23:16:58 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: getaddrinfo.c,v 1.42.4.2 2000/07/13 05:51:20 itojun Exp $      */
-/*     $KAME: getaddrinfo.c,v 1.24 2000/07/09 04:19:22 itojun Exp $    */
+/*     $NetBSD: getaddrinfo.c,v 1.42.4.3 2000/08/31 23:16:58 itojun Exp $      */
+/*     $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.42.4.2 2000/07/13 05:51:20 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.42.4.3 2000/08/31 23:16:58 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -1334,7 +1334,7 @@
        const struct addrinfo *pai;
 {
        char *p;
-       char *cp, *tname;
+       char *cp, *tname, *cname;
        struct addrinfo hints, *res0, *res;
        int error;
        const char *addr;
@@ -1355,11 +1355,14 @@
        *cp++ = '\0';
        addr = p;
        /* if this is not something we're looking for, skip it. */
+       cname = NULL;
        while (cp && *cp) {
                if (*cp == ' ' || *cp == '\t') {
                        cp++;
                        continue;
                }
+               if (!cname)
+                       cname = cp;
                tname = cp;
                if ((cp = strpbrk(cp, " \t")) != NULL)
                        *cp++ = '\0';
@@ -1379,7 +1382,7 @@
                res->ai_flags = pai->ai_flags;
 
                if (pai->ai_flags & AI_CANONNAME) {
-                       if (get_canonname(pai, res, name) != 0) {
+                       if (get_canonname(pai, res, cname) != 0) {
                                freeaddrinfo(res0);
                                goto again;
                        }



Home | Main Index | Thread Index | Old Index