Loading changes/bug3894 0 → 100644 +4 −0 Original line number Diff line number Diff line o Build fixes: - Clean up some code issues that prevented Tor from building on older BSDs. Fixes bug 3894; reported by grarpamp. configure.in +1 −1 Original line number Diff line number Diff line Loading @@ -229,7 +229,7 @@ dnl ------------------------------------------------------------------- dnl Check for functions before libevent, since libevent-1.2 apparently dnl exports strlcpy without defining it in a header. AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf) AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf lround rint) using_custom_malloc=no if test x$enable_openbsd_malloc = xyes ; then Loading src/common/torgzip.c +2 −1 Original line number Diff line number Diff line Loading @@ -14,11 +14,12 @@ #include <stdio.h> #include <assert.h> #include <string.h> #include "torint.h" #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #include "torint.h" #include "util.h" #include "torlog.h" #include "torgzip.h" Loading src/common/util.c +5 −3 Original line number Diff line number Diff line Loading @@ -334,10 +334,12 @@ tor_mathlog(double d) long tor_lround(double d) { #ifdef _MSC_VER return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5)); #else #if defined(HAVE_LROUND) return lround(d); #elif defined(HAVE_RINT) return (long)rint(d); #else return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5)); #endif } Loading src/or/circuitbuild.c +9 −8 Original line number Diff line number Diff line Loading @@ -1237,7 +1237,7 @@ circuit_build_times_network_check_changed(circuit_build_times_t *cbt) if (cbt->timeout_ms >= circuit_build_times_get_initial_timeout()) { if (cbt->timeout_ms > INT32_MAX/2 || cbt->close_ms > INT32_MAX/2) { log_warn(LD_CIRC, "Insanely large circuit build timeout value. " "(timeout = %lfmsec, close = %lfmsec)", "(timeout = %fmsec, close = %fmsec)", cbt->timeout_ms, cbt->close_ms); } else { cbt->timeout_ms *= 2; Loading Loading @@ -1414,7 +1414,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) return; if (cbt->timeout_ms < circuit_build_times_min_timeout()) { log_warn(LD_CIRC, "Set buildtimeout to low value %lfms. Setting to %dms", log_warn(LD_CIRC, "Set buildtimeout to low value %fms. Setting to %dms", cbt->timeout_ms, circuit_build_times_min_timeout()); cbt->timeout_ms = circuit_build_times_min_timeout(); if (cbt->close_ms < cbt->timeout_ms) { Loading @@ -1436,7 +1436,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) cbt->total_build_times, tor_lround(cbt->timeout_ms/1000)); log_info(LD_CIRC, "Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f", cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate); } else if (prev_timeout < tor_lround(cbt->timeout_ms/1000)) { Loading @@ -1447,13 +1447,13 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) cbt->total_build_times, tor_lround(cbt->timeout_ms/1000)); log_info(LD_CIRC, "Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f", cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate); } else { log_info(LD_CIRC, "Set circuit build timeout to %lds (%lfms, %lfms, Xm: %d, a: %lf," " r: %lf) based on %d circuit times", "Set circuit build timeout to %lds (%fms, %fms, Xm: %d, a: %f," " r: %f) based on %d circuit times", tor_lround(cbt->timeout_ms/1000), cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate, cbt->total_build_times); Loading Loading @@ -4095,7 +4095,7 @@ choose_random_entry(cpath_build_state_t *state) retry: smartlist_clear(live_entry_guards); SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry, SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) { const char *msg; r = entry_is_live(entry, need_uptime, need_capacity, 0, &msg); Loading Loading @@ -4131,7 +4131,8 @@ choose_random_entry(cpath_build_state_t *state) } if (smartlist_len(live_entry_guards) >= options->NumEntryGuards) break; /* we have enough */ }); } SMARTLIST_FOREACH_END(entry); if (entry_list_is_constrained(options)) { /* If we prefer the entry nodes we've got, and we have at least Loading Loading
changes/bug3894 0 → 100644 +4 −0 Original line number Diff line number Diff line o Build fixes: - Clean up some code issues that prevented Tor from building on older BSDs. Fixes bug 3894; reported by grarpamp.
configure.in +1 −1 Original line number Diff line number Diff line Loading @@ -229,7 +229,7 @@ dnl ------------------------------------------------------------------- dnl Check for functions before libevent, since libevent-1.2 apparently dnl exports strlcpy without defining it in a header. AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf) AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf lround rint) using_custom_malloc=no if test x$enable_openbsd_malloc = xyes ; then Loading
src/common/torgzip.c +2 −1 Original line number Diff line number Diff line Loading @@ -14,11 +14,12 @@ #include <stdio.h> #include <assert.h> #include <string.h> #include "torint.h" #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #include "torint.h" #include "util.h" #include "torlog.h" #include "torgzip.h" Loading
src/common/util.c +5 −3 Original line number Diff line number Diff line Loading @@ -334,10 +334,12 @@ tor_mathlog(double d) long tor_lround(double d) { #ifdef _MSC_VER return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5)); #else #if defined(HAVE_LROUND) return lround(d); #elif defined(HAVE_RINT) return (long)rint(d); #else return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5)); #endif } Loading
src/or/circuitbuild.c +9 −8 Original line number Diff line number Diff line Loading @@ -1237,7 +1237,7 @@ circuit_build_times_network_check_changed(circuit_build_times_t *cbt) if (cbt->timeout_ms >= circuit_build_times_get_initial_timeout()) { if (cbt->timeout_ms > INT32_MAX/2 || cbt->close_ms > INT32_MAX/2) { log_warn(LD_CIRC, "Insanely large circuit build timeout value. " "(timeout = %lfmsec, close = %lfmsec)", "(timeout = %fmsec, close = %fmsec)", cbt->timeout_ms, cbt->close_ms); } else { cbt->timeout_ms *= 2; Loading Loading @@ -1414,7 +1414,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) return; if (cbt->timeout_ms < circuit_build_times_min_timeout()) { log_warn(LD_CIRC, "Set buildtimeout to low value %lfms. Setting to %dms", log_warn(LD_CIRC, "Set buildtimeout to low value %fms. Setting to %dms", cbt->timeout_ms, circuit_build_times_min_timeout()); cbt->timeout_ms = circuit_build_times_min_timeout(); if (cbt->close_ms < cbt->timeout_ms) { Loading @@ -1436,7 +1436,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) cbt->total_build_times, tor_lround(cbt->timeout_ms/1000)); log_info(LD_CIRC, "Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f", cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate); } else if (prev_timeout < tor_lround(cbt->timeout_ms/1000)) { Loading @@ -1447,13 +1447,13 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt) cbt->total_build_times, tor_lround(cbt->timeout_ms/1000)); log_info(LD_CIRC, "Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f", cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate); } else { log_info(LD_CIRC, "Set circuit build timeout to %lds (%lfms, %lfms, Xm: %d, a: %lf," " r: %lf) based on %d circuit times", "Set circuit build timeout to %lds (%fms, %fms, Xm: %d, a: %f," " r: %f) based on %d circuit times", tor_lround(cbt->timeout_ms/1000), cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate, cbt->total_build_times); Loading Loading @@ -4095,7 +4095,7 @@ choose_random_entry(cpath_build_state_t *state) retry: smartlist_clear(live_entry_guards); SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry, SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) { const char *msg; r = entry_is_live(entry, need_uptime, need_capacity, 0, &msg); Loading Loading @@ -4131,7 +4131,8 @@ choose_random_entry(cpath_build_state_t *state) } if (smartlist_len(live_entry_guards) >= options->NumEntryGuards) break; /* we have enough */ }); } SMARTLIST_FOREACH_END(entry); if (entry_list_is_constrained(options)) { /* If we prefer the entry nodes we've got, and we have at least Loading