Date: Fri, 3 Aug 2007 10:00:12 GMT From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <jinmei@isl.rdc.toshiba.co.jp> To: freebsd-standards@FreeBSD.org Subject: Re: standards/114910: getaddrinfo() fails to set ai_canonname Message-ID: <200708031000.l73A0CWn003429@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/114910; it has been noted by GNATS. From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <jinmei@isl.rdc.toshiba.co.jp> To: marka@isc.org Cc: bug-followup@FreeBSD.org Subject: Re: standards/114910: getaddrinfo() fails to set ai_canonname Date: Fri, 03 Aug 2007 18:57:27 +0900 Thanks for the report. Yes, it's a bug to be fixed. I think it should be handled around reorder() rather than in getanswer() since the same problem would happen for other resolution methods. I've copied an alternate proposed patch below. JINMEI, Tatuya Communication Platform Lab. Corporate R&D Center, Toshiba Corp. jinmei@isl.rdc.toshiba.co.jp Index: getaddrinfo.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/getaddrinfo.c,v retrieving revision 1.85 diff -u -r1.85 getaddrinfo.c --- getaddrinfo.c 23 Jul 2006 15:31:03 -0000 1.85 +++ getaddrinfo.c 3 Aug 2007 09:52:57 -0000 @@ -578,8 +578,24 @@ * in the most efficient order. */ if (hints == NULL || !(hints->ai_flags & AI_PASSIVE)) { - if (!numeric) + if (!numeric) { + char *canonname; + + canonname = + sentinel.ai_next->ai_canonname; + if (canonname != NULL) { + sentinel.ai_next->ai_canonname + = NULL; + } (void)reorder(&sentinel); + if (sentinel.ai_next->ai_canonname == + NULL) { + sentinel.ai_next->ai_canonname + = canonname; + } else { + free(canonname); + } + } } *res = sentinel.ai_next; return SUCCESS;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708031000.l73A0CWn003429>