You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.6 KiB

diff -up libtirpc-0.2.4/src/rtime.c.orig libtirpc-0.2.4/src/rtime.c
--- libtirpc-0.2.4/src/rtime.c.orig 2013-12-09 15:59:51.000000000 -0500
+++ libtirpc-0.2.4/src/rtime.c 2017-02-25 12:29:25.227847702 -0500
@@ -46,6 +46,7 @@
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
+#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
@@ -67,7 +68,8 @@ rtime(addrp, timep, timeout)
struct timeval *timeout;
{
int s;
- fd_set readfds;
+ struct pollfd fd;
+ int milliseconds;
int res;
unsigned long thetime;
struct sockaddr_in from;
@@ -94,31 +96,32 @@ rtime(addrp, timep, timeout)
addrp->sin_port = serv->s_port;
if (type == SOCK_DGRAM) {
- res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
+ res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
(struct sockaddr *)addrp, sizeof(*addrp));
if (res < 0) {
do_close(s);
- return(-1);
+ return(-1);
}
- do {
- FD_ZERO(&readfds);
- FD_SET(s, &readfds);
- res = select(_rpc_dtablesize(), &readfds,
- (fd_set *)NULL, (fd_set *)NULL, timeout);
- } while (res < 0 && errno == EINTR);
+
+ milliseconds = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
+ fd.fd = s;
+ fd.events = POLLIN;
+ do
+ res = poll (&fd, 1, milliseconds);
+ while (res < 0 && errno == EINTR);
if (res <= 0) {
if (res == 0) {
errno = ETIMEDOUT;
}
do_close(s);
- return(-1);
+ return(-1);
}
fromlen = sizeof(from);
- res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
+ res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
(struct sockaddr *)&from, &fromlen);
do_close(s);
if (res < 0) {
- return(-1);
+ return(-1);
}
} else {
if (connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
diff -up libtirpc-0.2.4/src/svc_vc.c.orig libtirpc-0.2.4/src/svc_vc.c
--- libtirpc-0.2.4/src/svc_vc.c.orig 2017-02-25 12:26:55.430978326 -0500
+++ libtirpc-0.2.4/src/svc_vc.c 2017-02-25 12:29:25.227847702 -0500
@@ -260,14 +260,8 @@ makefd_xprt(fd, sendsize, recvsize)
struct cf_conn *cd;
const char *netid;
struct __rpc_sockinfo si;
-
- assert(fd != -1);
- if (fd >= FD_SETSIZE) {
- warnx("svc_vc: makefd_xprt: fd too high\n");
- xprt = NULL;
- goto done;
- }
+ assert(fd != -1);
xprt = mem_alloc(sizeof(SVCXPRT));
if (xprt == NULL) {
@@ -340,6 +334,8 @@ again:
*/
newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
+ if (!newxprt)
+ return (FALSE);
if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
return (FALSE);