From 2451479cbccbbaeea154c80c08fe2e08142cd425 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 22 Jan 2009 16:37:09 +0000 Subject: [PATCH] Backport the trivial parts of r18234, especially the one that makes compilation not fail on dev netbsd. svn:r18236 --- ChangeLog | 6 ++++++ src/common/torint.h | 2 ++ src/common/util.c | 2 +- src/or/circuituse.c | 2 +- src/or/main.c | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79255c448..4106848d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Changes in version 0.2.0.34 - 2009-??-?? + o Minor bugfixes: + - Fix compilation on systems where time-t is a 64-bit integer. + Patch from Matthias Drochner. + + Changes in version 0.2.0.33 - 2009-01-21 o Security fixes: - Fix a heap-corruption bug that may be remotely triggerable on diff --git a/src/common/torint.h b/src/common/torint.h index 6f515495d..4ef6c79e5 100644 --- a/src/common/torint.h +++ b/src/common/torint.h @@ -290,6 +290,8 @@ typedef uint32_t uintptr_t; #define TIME_MAX ((time_t)INT_MAX) #elif (SIZEOF_TIME_T == SIZEOF_LONG) #define TIME_MAX ((time_t)LONG_MAX) +#elif (SIZEOF_TIME_T == 8) +#define TIME_MAX ((time_t)INT64_MAX) #else #error "Can't define (signed) TIME_MAX" #endif diff --git a/src/common/util.c b/src/common/util.c index 221821ed3..579121219 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1011,7 +1011,7 @@ tor_timegm(struct tm *tm) hours = days*24 + tm->tm_hour; minutes = hours*60 + tm->tm_min; - ret = minutes*60 + tm->tm_sec; + ret = ((time_t)minutes)*60 + tm->tm_sec; return ret; } diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 083f21567..6710699c9 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -472,7 +472,7 @@ circuit_predict_and_launch_new(void) void circuit_build_needed_circs(time_t now) { - static long time_to_new_circuit = 0; + static time_t time_to_new_circuit = 0; or_options_t *options = get_options(); /* launch a new circ for any pending streams that need one */ diff --git a/src/or/main.c b/src/or/main.c index 165babaa7..e4d84ac99 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1178,7 +1178,7 @@ second_elapsed_callback(int fd, short event, void *args) * could use libevent's timers for this rather than checking the current * time against a bunch of timeouts every second. */ static struct timeval one_second; - static long current_second = 0; + static time_t current_second = 0; struct timeval now; size_t bytes_written; size_t bytes_read;