(hookup): handle ai_canonname not being set

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7609 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-12-16 11:49:11 +00:00
parent 790215124e
commit db533316bd

View File

@@ -76,7 +76,10 @@ hookup (const char *host, int port)
code = -1;
return NULL;
}
strlcpy (hostnamebuf, ai->ai_canonname, sizeof(hostnamebuf));
if (ai->ai_canonname != NULL)
strlcpy (hostnamebuf, ai->ai_canonname, sizeof(hostnamebuf));
else
strlcpy (hostnamebuf, host, sizeof(hostnamebuf));
hostname = hostnamebuf;
for (a = ai; a != NULL; a = a->ai_next) {