e6ecb54
diff -rup a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
e6ecb54
--- a/sunrpc/svc_tcp.c	2012-05-31 20:37:43.000000000 -0600
e6ecb54
+++ b/sunrpc/svc_tcp.c	2012-06-05 11:30:09.948733571 -0600
e6ecb54
@@ -44,6 +44,7 @@
e6ecb54
 #include <sys/poll.h>
e6ecb54
 #include <errno.h>
e6ecb54
 #include <stdlib.h>
e6ecb54
+#include <time.h>
e6ecb54
 
e6ecb54
 #include <wchar.h>
e6ecb54
 #include <libio/iolibio.h>
e6ecb54
@@ -247,6 +248,11 @@ again:
e6ecb54
     {
e6ecb54
       if (errno == EINTR)
e6ecb54
 	goto again;
e6ecb54
+      if (errno == EMFILE)
e6ecb54
+        {
e6ecb54
+          struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
e6ecb54
+          __nanosleep(&ts , NULL);
e6ecb54
+        }
e6ecb54
       return FALSE;
e6ecb54
     }
e6ecb54
   /*
e6ecb54
diff -rup a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
e6ecb54
--- a/sunrpc/svc_udp.c	2012-05-31 20:37:43.000000000 -0600
e6ecb54
+++ b/sunrpc/svc_udp.c	2012-06-05 11:30:09.948733571 -0600
e6ecb54
@@ -40,6 +40,7 @@
e6ecb54
 #include <sys/socket.h>
e6ecb54
 #include <errno.h>
e6ecb54
 #include <libintl.h>
e6ecb54
+#include <time.h>
e6ecb54
 
e6ecb54
 #ifdef IP_PKTINFO
e6ecb54
 #include <sys/uio.h>
e6ecb54
@@ -277,8 +278,16 @@ again:
e6ecb54
 		       (int) su->su_iosz, 0,
e6ecb54
 		       (struct sockaddr *) &(xprt->xp_raddr), &len;;
e6ecb54
   xprt->xp_addrlen = len;
e6ecb54
-  if (rlen == -1 && errno == EINTR)
e6ecb54
-    goto again;
e6ecb54
+  if (rlen == -1)
e6ecb54
+    {
e6ecb54
+      if (errno == EINTR)
e6ecb54
+        goto again;
e6ecb54
+      if (errno == EMFILE)
e6ecb54
+        {
e6ecb54
+          struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
e6ecb54
+          __nanosleep(&ts , NULL);
e6ecb54
+        }
e6ecb54
+    }
e6ecb54
   if (rlen < 16)		/* < 4 32-bit ints? */
e6ecb54
     return FALSE;
e6ecb54
   xdrs->x_op = XDR_DECODE;
e6ecb54
diff -rup a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
e6ecb54
--- a/sunrpc/svc_unix.c	2012-05-31 20:37:43.000000000 -0600
e6ecb54
+++ b/sunrpc/svc_unix.c	2012-06-05 11:30:36.495612770 -0600
e6ecb54
@@ -46,6 +46,7 @@
e6ecb54
 #include <errno.h>
e6ecb54
 #include <stdlib.h>
e6ecb54
 #include <libintl.h>
e6ecb54
+#include <time.h>
e6ecb54
 #include <wchar.h>
e6ecb54
 
e6ecb54
 /*
e6ecb54
@@ -244,6 +245,11 @@ again:
e6ecb54
     {
e6ecb54
       if (errno == EINTR)
e6ecb54
 	goto again;
e6ecb54
+      if (errno == EMFILE)
e6ecb54
+        {
e6ecb54
+          struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
e6ecb54
+          __nanosleep(&ts , NULL);
e6ecb54
+        }
e6ecb54
       return FALSE;
e6ecb54
     }
e6ecb54
   /*