-/* $OpenBSD: clnt_tcp.c,v 1.30 2017/12/14 16:55:44 jca Exp $ */
+/* $OpenBSD: clnt_tcp.c,v 1.31 2017/12/14 18:56:22 jca Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
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)
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;
-/* $OpenBSD: clnt_udp.c,v 1.33 2017/12/14 16:55:44 jca Exp $ */
+/* $OpenBSD: clnt_udp.c,v 1.34 2017/12/14 18:56:22 jca Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
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;
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);
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);
-/* $OpenBSD: svc_tcp.c,v 1.38 2017/12/14 16:55:44 jca Exp $ */
+/* $OpenBSD: svc_tcp.c,v 1.39 2017/12/14 18:56:22 jca Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
{
int sock = xprt->xp_sock;
int nready;
- struct timespec start, delta, tmp1, tmp2;
+ struct timespec start, after, duration, delta;
struct pollfd pfd[1];
/*
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;