Correctly print out "Connected to" hostname.

Temporal buffer was used for the hostname and freed before actually used.

Specified by: ru
Approved by: jkh
This commit is contained in:
Yoshinobu Inoue 2000-02-24 19:01:38 +00:00
parent c9f2d5f483
commit 88a845c11d

View File

@ -134,10 +134,9 @@ hookup(host0, port)
} }
res = res0; res = res0;
if (res->ai_canonname) if (res->ai_canonname) {
hostname = res->ai_canonname; (void) strncpy(hostnamebuf, res->ai_canonname,
else { sizeof(hostnamebuf));
(void) strncpy(hostnamebuf, host, sizeof(hostnamebuf));
hostname = hostnamebuf; hostname = hostnamebuf;
} }
while (1) { while (1) {