2011-07-07 16:52:52 +02:00
|
|
|
For details see:
|
2011-07-04 15:26:19 +02:00
|
|
|
http://sourceware.org/bugzilla/show_bug.cgi?id=5379
|
|
|
|
|
2011-08-17 21:42:24 +02:00
|
|
|
|
2015-02-10 11:34:33 +01:00
|
|
|
Index: glibc-2.20/sunrpc/clnt_udp.c
|
2011-07-20 14:59:52 +02:00
|
|
|
===================================================================
|
2015-02-10 11:34:33 +01:00
|
|
|
--- glibc-2.20.orig/sunrpc/clnt_udp.c
|
|
|
|
+++ glibc-2.20/sunrpc/clnt_udp.c
|
2013-08-06 16:52:55 +02:00
|
|
|
@@ -308,6 +308,7 @@ clntudp_call (cl, proc, xargs, argsp, xr
|
2011-07-20 14:59:52 +02:00
|
|
|
XDR *xdrs;
|
|
|
|
int outlen = 0;
|
2009-02-20 08:46:43 +01:00
|
|
|
int inlen;
|
2011-07-20 14:59:52 +02:00
|
|
|
+ int pollresult;
|
2009-02-20 08:46:43 +01:00
|
|
|
socklen_t fromlen;
|
|
|
|
struct pollfd fd;
|
2011-07-20 14:59:52 +02:00
|
|
|
int milliseconds = (cu->cu_wait.tv_sec * 1000) +
|
2015-02-10 11:34:33 +01:00
|
|
|
@@ -378,37 +379,39 @@ send_again:
|
2009-02-20 08:46:43 +01:00
|
|
|
anyup = 0;
|
|
|
|
for (;;)
|
|
|
|
{
|
2011-07-20 14:59:52 +02:00
|
|
|
- switch (__poll (&fd, 1, milliseconds))
|
|
|
|
+ switch (pollresult = __poll (&fd, 1, milliseconds))
|
|
|
|
{
|
|
|
|
-
|
|
|
|
case 0:
|
|
|
|
- if (anyup == 0)
|
2015-02-10 11:34:33 +01:00
|
|
|
+ case -1:
|
|
|
|
+ if (pollresult == 0 || errno == EINTR)
|
|
|
|
{
|
2011-07-20 14:59:52 +02:00
|
|
|
- anyup = is_network_up (cu->cu_sock);
|
|
|
|
- if (!anyup)
|
|
|
|
- return (cu->cu_error.re_status = RPC_CANTRECV);
|
2015-02-10 11:34:33 +01:00
|
|
|
+ if (anyup == 0)
|
|
|
|
+ {
|
|
|
|
+ anyup = is_network_up (cu->cu_sock);
|
|
|
|
+ if (!anyup)
|
|
|
|
+ return (cu->cu_error.re_status = RPC_CANTRECV);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ time_waited.tv_sec += cu->cu_wait.tv_sec;
|
|
|
|
+ time_waited.tv_usec += cu->cu_wait.tv_usec;
|
|
|
|
+ while (time_waited.tv_usec >= 1000000)
|
|
|
|
+ {
|
|
|
|
+ time_waited.tv_sec++;
|
|
|
|
+ time_waited.tv_usec -= 1000000;
|
|
|
|
+ }
|
|
|
|
+ if ((time_waited.tv_sec < timeout.tv_sec) ||
|
|
|
|
+ ((time_waited.tv_sec == timeout.tv_sec) &&
|
|
|
|
+ (time_waited.tv_usec < timeout.tv_usec)))
|
|
|
|
+ {
|
|
|
|
+ if (pollresult == 0)
|
|
|
|
+ goto send_again;
|
|
|
|
+ else
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ return (cu->cu_error.re_status = RPC_TIMEDOUT);
|
|
|
|
}
|
|
|
|
|
2011-07-20 14:59:52 +02:00
|
|
|
- time_waited.tv_sec += cu->cu_wait.tv_sec;
|
|
|
|
- time_waited.tv_usec += cu->cu_wait.tv_usec;
|
|
|
|
- while (time_waited.tv_usec >= 1000000)
|
|
|
|
- {
|
|
|
|
- time_waited.tv_sec++;
|
|
|
|
- time_waited.tv_usec -= 1000000;
|
|
|
|
- }
|
|
|
|
- if ((time_waited.tv_sec < timeout.tv_sec) ||
|
|
|
|
- ((time_waited.tv_sec == timeout.tv_sec) &&
|
|
|
|
- (time_waited.tv_usec < timeout.tv_usec)))
|
|
|
|
- goto send_again;
|
|
|
|
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * buggy in other cases because time_waited is not being
|
|
|
|
- * updated.
|
|
|
|
- */
|
2015-02-10 11:34:33 +01:00
|
|
|
- case -1:
|
2011-07-20 14:59:52 +02:00
|
|
|
- if (errno == EINTR)
|
2009-02-20 08:46:43 +01:00
|
|
|
- continue;
|
2011-07-20 14:59:52 +02:00
|
|
|
+ /* errno != EINTR */
|
2009-02-20 08:46:43 +01:00
|
|
|
cu->cu_error.re_errno = errno;
|
|
|
|
return (cu->cu_error.re_status = RPC_CANTRECV);
|
|
|
|
}
|