Module Name:    src
Committed By:   christos
Date:           Fri Nov 13 15:23:17 UTC 2015

Modified Files:
        src/lib/libc/rpc: rpc_soc.c

Log Message:
Generalize the test, compare on the protocol semantics instead of the name
since it could be udp6...


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/rpc/rpc_soc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/rpc/rpc_soc.c
diff -u src/lib/libc/rpc/rpc_soc.c:1.22 src/lib/libc/rpc/rpc_soc.c:1.23
--- src/lib/libc/rpc/rpc_soc.c:1.22	Fri Nov 13 06:23:08 2015
+++ src/lib/libc/rpc/rpc_soc.c	Fri Nov 13 10:23:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_soc.c,v 1.22 2015/11/13 11:23:08 tron Exp $	*/
+/*	$NetBSD: rpc_soc.c,v 1.23 2015/11/13 15:23:17 christos Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -45,7 +45,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_soc.c 1.41 89/05/02 Copyr 1988 Sun Micro";
 #else
-__RCSID("$NetBSD: rpc_soc.c,v 1.22 2015/11/13 11:23:08 tron Exp $");
+__RCSID("$NetBSD: rpc_soc.c,v 1.23 2015/11/13 15:23:17 christos Exp $");
 #endif
 #endif
 
@@ -255,13 +255,22 @@ svc_com_create(int fd, u_int sendsize, u
 	memset(&sccsin, 0, sizeof sccsin);
 	sccsin.sin_family = AF_INET;
 	(void)bindresvport(fd, &sccsin);
-	if (strcmp(netid, "udp") != 0 && listen(fd, SOMAXCONN) == -1) {
-		(void) syslog(LOG_ERR,
-		   "svc%s_create: listen(2) failed: %s",
-		   netid, strerror(errno));
-		(void) freenetconfigent(nconf);
- 		goto out;
+
+	switch (nconf->nc_semantics) {
+	case NC_TPI_COTS:
+	case NC_TPI_COTS_ORD:
+		if (listen(fd, SOMAXCONN) == -1) {
+			(void) syslog(LOG_ERR,
+			    "svc%s_create: listen(2) failed: %s",
+			    netid, strerror(errno));
+			(void) freenetconfigent(nconf);
+			goto out;
+		}
+		break;
+	default:
+		break;
 	}
+
 	svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize);
 	(void) freenetconfigent(nconf);
 	if (svc == NULL)

Reply via email to