Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/telnet recover old error message on unknown service ...



details:   https://anonhg.NetBSD.org/src/rev/3b57ec3f05d5
branches:  trunk
changeset: 486090:3b57ec3f05d5
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat May 13 03:13:59 2000 +0000

description:
recover old error message on unknown service ("telnet localhost foo"
when foo is not valid).  gai_strerror may be too generic.
fix suggested in openbsd camp.

diffstat:

 usr.bin/telnet/commands.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 88bd65a3d6cd -r 3b57ec3f05d5 usr.bin/telnet/commands.c
--- a/usr.bin/telnet/commands.c Sat May 13 03:12:56 2000 +0000
+++ b/usr.bin/telnet/commands.c Sat May 13 03:13:59 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: commands.c,v 1.39 2000/02/29 19:36:43 itojun Exp $     */
+/*     $NetBSD: commands.c,v 1.40 2000/05/13 03:13:59 itojun Exp $     */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -67,7 +67,7 @@
 #if 0
 static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: commands.c,v 1.39 2000/02/29 19:36:43 itojun Exp $");
+__RCSID("$NetBSD: commands.c,v 1.40 2000/05/13 03:13:59 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -2326,7 +2326,10 @@
        hints.ai_protocol = 0;
        hints.ai_flags = AI_CANONNAME;
        error = getaddrinfo(hostname, portp, &hints, &res0);
-       if (error) {
+       if (error == EAI_SERVICE) {
+           fprintf(stderr, "tcp/%s: unknown service\n", portp);
+           return 0;
+       } else if (error) {
            fprintf(stderr, "%s: %s\n", hostname, gai_strerror(error));
            return 0;
        }



Home | Main Index | Thread Index | Old Index