Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/inetd emit more friendly message on nonexistent ser...



details:   https://anonhg.NetBSD.org/src/rev/27013dfa1d02
branches:  trunk
changeset: 494237:27013dfa1d02
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jul 04 09:33:55 2000 +0000

description:
emit more friendly message on nonexistent service name.
From: enami

diffstat:

 usr.sbin/inetd/inetd.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r e52bf1e9de9c -r 27013dfa1d02 usr.sbin/inetd/inetd.c
--- a/usr.sbin/inetd/inetd.c    Tue Jul 04 08:57:44 2000 +0000
+++ b/usr.sbin/inetd/inetd.c    Tue Jul 04 09:33:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inetd.c,v 1.64 2000/07/03 23:40:59 itojun Exp $        */
+/*     $NetBSD: inetd.c,v 1.65 2000/07/04 09:33:55 itojun Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c    8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.64 2000/07/03 23:40:59 itojun Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.65 2000/07/04 09:33:55 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -873,10 +873,10 @@
                        memset(&hints, 0, sizeof(hints));
                        hints.ai_family = sep->se_family;
                        hints.ai_socktype = sep->se_socktype;
-                       if (!strcmp(sep->se_hostaddr, "*")) {
-                               hints.ai_flags = AI_PASSIVE;
+                       hints.ai_flags = AI_PASSIVE;
+                       if (!strcmp(sep->se_hostaddr, "*"))
                                host = NULL;
-                       } else
+                       else
                                host = sep->se_hostaddr;
                        if (isrpcservice(sep) || ISMUX(sep))
                                port = "0";
@@ -884,12 +884,16 @@
                                port = sep->se_service;
                        error = getaddrinfo(host, port, &hints, &res);
                        if (error) {
-                               if (host == NULL) {
+                               if (error == EAI_FAMILY && host == NULL) {
                                        syslog(LOG_WARNING, "%s/%s: %s: "
                                            "the address family is not "
                                            "supported by the kernel",
                                            sep->se_service, sep->se_proto,
                                            sep->se_hostaddr);
+                               } else if (error == EAI_SERVICE) {
+                                       syslog(LOG_WARNING, "%s/%s: "
+                                           "unknown service",
+                                           sep->se_service, sep->se_proto);
                                } else {
                                        syslog(LOG_ERR, "%s/%s: %s: %s",
                                            sep->se_service, sep->se_proto,



Home | Main Index | Thread Index | Old Index