Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/rpc Generalize the test, compare on the protocol se...



details:   https://anonhg.NetBSD.org/src/rev/fa82fbbcb9f6
branches:  trunk
changeset: 341608:fa82fbbcb9f6
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 13 15:23:17 2015 +0000

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

diffstat:

 lib/libc/rpc/rpc_soc.c |  25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diffs (47 lines):

diff -r b3faaa77d0c6 -r fa82fbbcb9f6 lib/libc/rpc/rpc_soc.c
--- a/lib/libc/rpc/rpc_soc.c    Fri Nov 13 15:22:12 2015 +0000
+++ b/lib/libc/rpc/rpc_soc.c    Fri Nov 13 15:23:17 2015 +0000
@@ -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 @@
        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)



Home | Main Index | Thread Index | Old Index