aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>2000-09-24 01:54:49 +0000
committerGarrett Wollman <wollman@FreeBSD.org>2000-09-24 01:54:49 +0000
commit2804330f1a31f3e539854b024c4b4b2b98cd8c43 (patch)
treef206254ebaab658c09f29999df52135c4ba068b0 /usr.bin
parentfd2802cfe02ce3da0c98f4ade0664c913b02b55b (diff)
downloadsrc-2804330f1a31f3e539854b024c4b4b2b98cd8c43.tar.gz
src-2804330f1a31f3e539854b024c4b4b2b98cd8c43.zip
Don't assume ai0->ai_canonname will always be filled in. Print the
user-supplied host name if we can't get a canonical name. Obtained from: contrib/tcp_wrappers/socket.c rev. 1.4 (in spirit)
Notes
Notes: svn path=/head/; revision=66315
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/finger/net.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index 00547eca58cb..427d2335cf20 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -96,7 +96,12 @@ netfinger(name)
}
multi = (ai0->ai_next) != 0;
- printf("[%s]\n", ai0->ai_canonname);
+
+ /* ai_canonname may not be filled in if the user specified an IP. */
+ if (ai0->ai_canonname == 0)
+ printf("[%s]\n", host);
+ else
+ printf("[%s]\n", ai0->ai_canonname);
for (ai = ai0; ai != 0; ai = ai->ai_next) {
if (multi)