Diff committed, thank you Scott. Here's another diff on top to remove two useless temporary variables, and unify the names of the remaining ones.
ok? Index: clnt_tcp.c =================================================================== --- clnt_tcp.c.orig +++ clnt_tcp.c @@ -385,7 +385,7 @@ static int readtcp(struct ct_data *ct, caddr_t buf, int len) { struct pollfd pfd[1]; - struct timespec start, after, duration, tmp, delta, wait; + struct timespec start, after, duration, delta, wait; int r, save_errno; if (len == 0) @@ -402,8 +402,7 @@ readtcp(struct ct_data *ct, caddr_t buf, clock_gettime(CLOCK_MONOTONIC, &after); timespecsub(&start, &after, &duration); - timespecsub(&wait, &duration, &tmp); - delta = tmp; + timespecsub(&wait, &duration, &delta); if (delta.tv_sec < 0 || !timespecisset(&delta)) r = 0; Index: clnt_udp.c =================================================================== --- clnt_udp.c.orig +++ clnt_udp.c @@ -216,7 +216,7 @@ clntudp_call(CLIENT *cl, /* client handl struct sockaddr_in from; struct rpc_msg reply_msg; XDR reply_xdrs; - struct timespec time_waited, start, after, tmp1, tmp2, wait; + struct timespec time_waited, start, after, duration, wait; bool_t ok; int nrefreshes = 2; /* number of times to refresh cred */ struct timespec timeout; @@ -271,8 +271,7 @@ send_again: for (;;) { switch (ppoll(pfd, 1, &wait, NULL)) { case 0: - timespecadd(&time_waited, &wait, &tmp1); - time_waited = tmp1; + timespecadd(&time_waited, &wait, &time_waited); if (timespeccmp(&time_waited, &timeout, <)) goto send_again; return (cu->cu_error.re_status = RPC_TIMEDOUT); @@ -287,9 +286,8 @@ send_again: case -1: if (errno == EINTR) { clock_gettime(CLOCK_MONOTONIC, &after); - timespecsub(&after, &start, &tmp1); - timespecadd(&time_waited, &tmp1, &tmp2); - time_waited = tmp2; + timespecsub(&after, &start, &duration); + timespecadd(&time_waited, &duration, &time_waited); if (timespeccmp(&time_waited, &timeout, <)) continue; return (cu->cu_error.re_status = RPC_TIMEDOUT); Index: svc_tcp.c =================================================================== --- svc_tcp.c.orig +++ svc_tcp.c @@ -333,7 +333,7 @@ readtcp(SVCXPRT *xprt, caddr_t buf, int { int sock = xprt->xp_sock; int nready; - struct timespec start, delta, tmp1, tmp2; + struct timespec start, after, duration, delta; struct pollfd pfd[1]; /* @@ -350,12 +350,11 @@ readtcp(SVCXPRT *xprt, caddr_t buf, int case -1: if (errno != EINTR) goto fatal_err; - clock_gettime(CLOCK_MONOTONIC, &tmp1); - timespecsub(&tmp1, &start, &tmp2); - timespecsub(&wait_per_try, &tmp2, &tmp1); - if (tmp1.tv_sec < 0 || !timespecisset(&tmp1)) + clock_gettime(CLOCK_MONOTONIC, &after); + timespecsub(&after, &start, &duration); + timespecsub(&wait_per_try, &duration, &delta); + if (delta.tv_sec < 0 || !timespecisset(&delta)) goto fatal_err; - delta = tmp1; continue; case 0: goto fatal_err; -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE