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-02 18:21:00.000000000 +0200 @@ -905,8 +905,8 @@ TIME parse_date_core(cfile) struct parse *cfile; { - int guess; - int tzoff, wday, year, mon, mday, hour, min, sec; + TIME guess; + long int tzoff, wday, year, mon, mday, hour, min, sec; const char *val; enum dhcp_token token; static int months [11] = { 31, 59, 90, 120, 151, 181, @@ -931,7 +931,7 @@ parse_date_core(cfile) return (TIME)0; } - guess = atoi(val); + guess = atol(val); if (!parse_semi(cfile)) return (TIME)0; @@ -945,7 +945,7 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - wday = atoi (val); + wday = atol (val); /* Year... */ token = next_token (&val, (unsigned *)0, cfile); @@ -960,7 +960,7 @@ parse_date_core(cfile) somebody invents a time machine, I think we can safely disregard it. This actually works around a stupid Y2K bug that was present in a very early beta release of dhcpd. */ - year = atoi (val); + year = atol (val); if (year > 1900) year -= 1900; @@ -982,7 +982,7 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - mon = atoi (val) - 1; + mon = atol (val) - 1; /* Slash separating month from day... */ token = next_token (&val, (unsigned *)0, cfile); @@ -1002,7 +1002,7 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - mday = atoi (val); + mday = atol (val); /* Hour... */ token = next_token (&val, (unsigned *)0, cfile); @@ -1012,7 +1012,7 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - hour = atoi (val); + hour = atol (val); /* Colon separating hour from minute... */ token = next_token (&val, (unsigned *)0, cfile); @@ -1032,7 +1032,7 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - min = atoi (val); + min = atol (val); /* Colon separating minute from second... */ token = next_token (&val, (unsigned *)0, cfile); @@ -1052,12 +1052,12 @@ parse_date_core(cfile) skip_to_semi (cfile); return (TIME)0; } - sec = atoi (val); + sec = atol (val); token = peek_token (&val, (unsigned *)0, cfile); if (token == NUMBER) { token = next_token (&val, (unsigned *)0, cfile); - tzoff = atoi (val); + tzoff = atol (val); } else tzoff = 0; @@ -1090,7 +1090,7 @@ TIME parse_date(cfile) struct parse *cfile; { - int guess; + TIME guess; guess = parse_date_core(cfile); /* Make sure the date ends in a semicolon... */