To define A RR to root (.) is valid in DNS. So, h_name = "" shouldn't

be treated as NULL.

PR:		bin/19816
Submitted by:	Bill Fenner <fenner@research.att.com>
Reviewed by:	Atsushi Onoe <onoe@sm.sony.co.jp>
This commit is contained in:
ume 2000-07-19 06:22:01 +00:00
parent f41547bc44
commit 174b0abb77

View File

@ -552,7 +552,7 @@ _hpcopy(struct hostent *hp, int *errp)
/* count size to be allocated */
size = sizeof(struct hostent);
if (hp->h_name != NULL && *hp->h_name != '\0')
if (hp->h_name != NULL)
size += strlen(hp->h_name) + 1;
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; i++, pp++) {
@ -580,7 +580,7 @@ _hpcopy(struct hostent *hp, int *errp)
return NULL;
}
cp = (char *)&nhp[1];
if (hp->h_name != NULL && *hp->h_name != '\0') {
if (hp->h_name != NULL) {
nhp->h_name = cp;
strcpy(cp, hp->h_name);
cp += strlen(cp) + 1;