diff options
-rw-r--r-- | usr.bin/ftp/ftp.c | 7 |
1 files changed, 3 insertions, 4 deletions
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) { |