From d693ba6b01e780960fb9d14ccf0ac6b6e383aa8e Mon Sep 17 00:00:00 2001 From: shin Date: Thu, 24 Feb 2000 19:01:38 +0000 Subject: 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(-) (limited to 'usr.bin/ftp') diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 3617376..d374fdd 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) { -- cgit v1.1