From owner-svn-src-all@FreeBSD.ORG Wed Jan 20 16:50:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB81C1065679; Wed, 20 Jan 2010 16:50:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A8C78FC1B; Wed, 20 Jan 2010 16:50:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0KGoEtS060230; Wed, 20 Jan 2010 16:50:14 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0KGoE1N060228; Wed, 20 Jan 2010 16:50:14 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201001201650.o0KGoE1N060228@svn.freebsd.org> From: Hiroki Sato Date: Wed, 20 Jan 2010 16:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202707 - head/usr.sbin/ypserv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2010 16:50:14 -0000 Author: hrs Date: Wed Jan 20 16:50:13 2010 New Revision: 202707 URL: http://svn.freebsd.org/changeset/base/202707 Log: Simply ignore unsupported protocols listed in /etc/netconfig and abort only if no transport is available. This fixes (INET && !INET6) and (!INET && INET6) case, for example. Modified: head/usr.sbin/ypserv/yp_main.c Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Wed Jan 20 16:28:39 2010 (r202706) +++ head/usr.sbin/ypserv/yp_main.c Wed Jan 20 16:50:13 2010 (r202707) @@ -450,6 +450,7 @@ main(int argc, char *argv[]) { int ch; int error; + int ntrans; void *nc_handle; struct netconfig *nconf; @@ -527,12 +528,13 @@ main(int argc, char *argv[]) /* * Create RPC service for each transport. */ + ntrans = 0; while((nconf = getnetconfig(nc_handle))) { if ((nconf->nc_flag & NC_VISIBLE)) { if (__rpc_nconf2sockinfo(nconf, &si) == 0) { - _msgout("cannot get information for %s", - nconf->nc_netid); - exit(1); + _msgout("cannot get information for %s. " + "Ignored.", nconf->nc_netid); + continue; } if (_rpcpmstart) { if (si.si_socktype != _rpcfdtype || @@ -545,12 +547,16 @@ main(int argc, char *argv[]) endnetconfig(nc_handle); exit(1); } + ntrans++; } } endnetconfig(nc_handle); while(!(SLIST_EMPTY(&ble_head))) SLIST_REMOVE_HEAD(&ble_head, ble_next); - + if (ntrans == 0) { + _msgout("no transport is available. Aborted."); + exit(1); + } if (_rpcpmstart) { (void) signal(SIGALRM, (SIG_PF) closedown); (void) alarm(_RPCSVC_CLOSEDOWN/2);