From 88a845c11d2f2056fe0249f52144e77e1dcdf41a Mon Sep 17 00:00:00 2001 From: Yoshinobu Inoue Date: Thu, 24 Feb 2000 19:01:38 +0000 Subject: [PATCH] Correctly print out "Connected to" hostname. Temporal buffer was used for the hostname and freed before actually used. Specified by: ru Approved by: jkh --- usr.bin/ftp/ftp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 36173761f2d3..d374fdd3a2ed 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -134,10 +134,9 @@ hookup(host0, port) } res = res0; - if (res->ai_canonname) - hostname = res->ai_canonname; - else { - (void) strncpy(hostnamebuf, host, sizeof(hostnamebuf)); + if (res->ai_canonname) { + (void) strncpy(hostnamebuf, res->ai_canonname, + sizeof(hostnamebuf)); hostname = hostnamebuf; } while (1) {