summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 00547ec..427d233 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)
OpenPOWER on IntegriCloud