Handle unsigned struct timeval members
The members of struct timeval on OpenVMS are unsigned. The logic for
calculating timeouts needs adjusting to deal with this.
RT#3862
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit fc52ac9028
)
This commit is contained in:
parent
dbcf8e3319
commit
4ae1c7771d
@ -299,16 +299,17 @@ static void dgram_adjust_rcv_timeout(BIO *b)
|
|||||||
|
|
||||||
/* Calculate time left until timer expires */
|
/* Calculate time left until timer expires */
|
||||||
memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));
|
memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));
|
||||||
timeleft.tv_sec -= timenow.tv_sec;
|
if (timeleft.tv_usec < timenow.tv_usec) {
|
||||||
timeleft.tv_usec -= timenow.tv_usec;
|
timeleft.tv_usec = 1000000 - timenow.tv_usec + timeleft.tv_usec;
|
||||||
if (timeleft.tv_usec < 0) {
|
|
||||||
timeleft.tv_sec--;
|
timeleft.tv_sec--;
|
||||||
timeleft.tv_usec += 1000000;
|
} else {
|
||||||
|
timeleft.tv_usec -= timenow.tv_usec;
|
||||||
}
|
}
|
||||||
|
if (timeleft.tv_sec < timenow.tv_sec) {
|
||||||
if (timeleft.tv_sec < 0) {
|
|
||||||
timeleft.tv_sec = 0;
|
timeleft.tv_sec = 0;
|
||||||
timeleft.tv_usec = 1;
|
timeleft.tv_usec = 1;
|
||||||
|
} else {
|
||||||
|
timeleft.tv_sec -= timenow.tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user