Source-Changes-HG archive

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

[src/trunk]: src/tests/fs/common/nfsrpc catch up with libc.



details:   https://anonhg.NetBSD.org/src/rev/649966099031
branches:  trunk
changeset: 785231:649966099031
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 05 05:39:54 2013 +0000

description:
catch up with libc.

diffstat:

 tests/fs/common/nfsrpc/svc.c |  26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r e969d1e3e74b -r 649966099031 tests/fs/common/nfsrpc/svc.c
--- a/tests/fs/common/nfsrpc/svc.c      Tue Mar 05 03:11:27 2013 +0000
+++ b/tests/fs/common/nfsrpc/svc.c      Tue Mar 05 05:39:54 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc.c,v 1.4 2010/09/23 09:38:14 he Exp $       */
+/*     $NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $ */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = "@(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)svc.c       2.4 88/08/11 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: svc.c,v 1.4 2010/09/23 09:38:14 he Exp $");
+__RCSID("$NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $");
 #endif
 #endif
 
@@ -180,9 +180,8 @@
 /*
  * Activate a transport handle.
  */
-void
-xprt_register(xprt)
-       SVCXPRT *xprt;
+bool_t
+xprt_register(SVCXPRT *xprt)
 {
        int sock;
 
@@ -194,18 +193,25 @@
        if (__svc_xports == NULL) {
                __svc_xports = mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
                if (__svc_xports == NULL) {
-                       warn("xprt_register");
+                       warn("%s: out of memory", __func__);
                        goto out;
                }
                memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
        }
-       if (sock < FD_SETSIZE) {
-               __svc_xports[sock] = xprt;
-               FD_SET(sock, get_fdset());
-               *get_fdsetmax() = max(*get_fdsetmax(), sock);
+       if (sock >= FD_SETSIZE) {
+               warnx("%s: socket descriptor %d too large for setsize %u",
+                   __func__, sock, (unsigned)FD_SETSIZE);
+               goto out;
        }
+       __svc_xports[sock] = xprt;
+       FD_SET(sock, &svc_fdset);
+       *get_fdsetmax() = max(*get_fdsetmax(), sock);
+       rwlock_unlock(&svc_fd_lock);
+       return (TRUE);
+
 out:
        rwlock_unlock(&svc_fd_lock);
+       return (FALSE);
 }
 
 void



Home | Main Index | Thread Index | Old Index