Module Name: src
Committed By: christos
Date: Tue Mar 5 05:39:54 UTC 2013
Modified Files:
src/tests/fs/common/nfsrpc: svc.c
Log Message:
catch up with libc.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/common/nfsrpc/svc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/fs/common/nfsrpc/svc.c
diff -u src/tests/fs/common/nfsrpc/svc.c:1.4 src/tests/fs/common/nfsrpc/svc.c:1.5
--- src/tests/fs/common/nfsrpc/svc.c:1.4 Thu Sep 23 05:38:14 2010
+++ src/tests/fs/common/nfsrpc/svc.c Tue Mar 5 00:39:54 2013
@@ -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 @@ get_fdsetmax()
/*
* Activate a transport handle.
*/
-void
-xprt_register(xprt)
- SVCXPRT *xprt;
+bool_t
+xprt_register(SVCXPRT *xprt)
{
int sock;
@@ -194,18 +193,25 @@ xprt_register(xprt)
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