diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-08-18 05:28:32 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-08-18 05:28:32 +0000 |
commit | b78974a50606ac41ac7fae9cc84618d6933e33a9 (patch) | |
tree | 2e25095d592a21be323f35d39401173f7e6257c1 /libexec | |
parent | d2322c9c80c2815ebc5558bda6c03136a44df2d5 (diff) |
check error result from getnameinfo.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/fingerd/fingerd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c index 83dcf9cd933..ad98e3a7e1d 100644 --- a/libexec/fingerd/fingerd.c +++ b/libexec/fingerd/fingerd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fingerd.c,v 1.18 2000/07/07 03:48:12 millert Exp $ */ +/* $OpenBSD: fingerd.c,v 1.19 2000/08/18 05:28:31 itojun Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)fingerd.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: fingerd.c,v 1.18 2000/07/07 03:48:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: fingerd.c,v 1.19 2000/08/18 05:28:31 itojun Exp $"; #endif #endif /* not lint */ @@ -123,6 +123,7 @@ main(argc, argv) if (logging) { struct sockaddr_storage ss; + struct sockaddr *sa; int sval; sval = sizeof(ss); @@ -130,8 +131,11 @@ main(argc, argv) /* err("getpeername: %s", strerror(errno)); */ exit(1); } - (void)getnameinfo((struct sockaddr *)&ss, ss.ss_len, - hostbuf, sizeof(hostbuf), NULL, 0, 0); + sa = (struct sockaddr *)&ss; + if (getnameinfo(sa, sa->sa_len, hostbuf, sizeof(hostbuf), + NULL, 0, 0) != 0) { + strncpy(hostbuf, "?", sizeof(hostbuf)); + } hname = hostbuf; } |