Another fix for handling time values on 64-bit platforms (#628258)

This commit is contained in:
Jiri Popelka 2010-09-02 18:43:01 +02:00
parent 63aa3f4bc6
commit 4ff3870707
2 changed files with 56 additions and 3 deletions

View File

@ -1,6 +1,56 @@
diff -up dhcp-4.2.0/common/dispatch.c.64-bit_lease_parse dhcp-4.2.0/common/dispatch.c
--- dhcp-4.2.0/common/dispatch.c.64-bit_lease_parse 2010-09-02 18:21:00.000000000 +0200
+++ dhcp-4.2.0/common/dispatch.c 2010-09-02 18:29:50.000000000 +0200
@@ -185,7 +185,7 @@ void add_timeout (when, where, what, ref
struct timeout *t, *q;
int usereset = 0;
isc_result_t status;
- int sec, usec;
+ struct timeval relative_time;
isc_interval_t interval;
isc_time_t expires;
@@ -297,24 +297,24 @@ void add_timeout (when, where, what, ref
* about the usec value, if it's zero we assume the caller didn't care.
*/
- sec = when->tv_sec - cur_tv.tv_sec;
- usec = when->tv_usec - cur_tv.tv_usec;
+ relative_time.tv_sec = when->tv_sec - cur_tv.tv_sec;
+ relative_time.tv_usec = when->tv_usec - cur_tv.tv_usec;
- if ((when->tv_usec != 0) && (usec < 0)) {
- sec--;
- usec += USEC_MAX;
+ if ((when->tv_usec != 0) && (relative_time.tv_usec < 0)) {
+ relative_time.tv_sec--;
+ relative_time.tv_usec += USEC_MAX;
}
- if (sec < 0) {
- sec = 0;
- usec = 0;
- } else if (usec < 0) {
- usec = 0;
- } else if (usec >= USEC_MAX) {
- usec = USEC_MAX - 1;
+ if (relative_time.tv_sec < 0) {
+ relative_time.tv_sec = 0;
+ relative_time.tv_usec = 0;
+ } else if (relative_time.tv_usec < 0) {
+ relative_time.tv_usec = 0;
+ } else if (relative_time.tv_usec >= USEC_MAX) {
+ relative_time.tv_usec = USEC_MAX - 1;
}
- isc_interval_set(&interval, sec, usec * 1000);
+ isc_interval_set(&interval, relative_time.tv_sec, relative_time.tv_usec * 1000);
status = isc_time_nowplusinterval(&expires, &interval);
if (status != ISC_R_SUCCESS) {
/*
diff -up dhcp-4.2.0/common/parse.c.64-bit_lease_parse dhcp-4.2.0/common/parse.c
--- dhcp-4.2.0/common/parse.c.64-bit_lease_parse 2009-10-28 05:12:29.000000000 +0100
+++ dhcp-4.2.0/common/parse.c 2010-09-01 13:06:31.000000000 +0200
+++ dhcp-4.2.0/common/parse.c 2010-09-02 18:21:00.000000000 +0200
@@ -905,8 +905,8 @@ TIME
parse_date_core(cfile)
struct parse *cfile;

View File

@ -7,7 +7,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.0
Release: 5%{?dist}
Release: 6%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -510,7 +510,10 @@ fi
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog
* Tue Sep 1 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-5
* Thu Sep 2 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-6
- Another fix for handling time values on 64-bit platforms (#628258)
* Wed Sep 1 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-5
- Fix parsing of lease file dates & times on 64-bit platforms (#628258)
* Tue Aug 31 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-4