manually backport a5232e0c4c

This commit is contained in:
Roger Dingledine 2011-10-26 17:11:52 -04:00
parent cecc5b7aa1
commit a68867b150
8 changed files with 11 additions and 10 deletions

4
changes/bug3208b Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes:
- Fix warnings from GCC 4.6's "-Wunused-but-set-variable" option.
Fixes bug 3208.

View File

@ -2297,7 +2297,6 @@ entry_guards_compute_status(void)
{ {
time_t now; time_t now;
int changed = 0; int changed = 0;
int severity = LOG_DEBUG;
or_options_t *options; or_options_t *options;
digestmap_t *reasons; digestmap_t *reasons;
if (! entry_guards) if (! entry_guards)
@ -2325,8 +2324,6 @@ entry_guards_compute_status(void)
if (remove_dead_entry_guards()) if (remove_dead_entry_guards())
changed = 1; changed = 1;
severity = changed ? LOG_DEBUG : LOG_INFO;
if (changed) { if (changed) {
SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) { SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) {
const char *reason = digestmap_get(reasons, entry->identity); const char *reason = digestmap_get(reasons, entry->identity);

View File

@ -621,6 +621,7 @@ command_process_netinfo_cell(cell_t *cell, or_connection_t *conn)
/* XXX maybe act on my_apparent_addr, if the source is sufficiently /* XXX maybe act on my_apparent_addr, if the source is sufficiently
* trustworthy. */ * trustworthy. */
(void)my_apparent_addr;
if (connection_or_set_state_open(conn)<0) if (connection_or_set_state_open(conn)<0)
connection_mark_for_close(TO_CONN(conn)); connection_mark_for_close(TO_CONN(conn));

View File

@ -2999,7 +2999,6 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp,
{ {
const char *status; const char *status;
char extended_buf[96]; char extended_buf[96];
int providing_reason=0;
if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS)) if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS))
return 0; return 0;
tor_assert(circ); tor_assert(circ);
@ -3023,7 +3022,6 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp,
const char *reason_str = circuit_end_reason_to_control_string(reason_code); const char *reason_str = circuit_end_reason_to_control_string(reason_code);
char *reason = NULL; char *reason = NULL;
size_t n=strlen(extended_buf); size_t n=strlen(extended_buf);
providing_reason=1;
if (!reason_str) { if (!reason_str) {
reason = tor_malloc(16); reason = tor_malloc(16);
tor_snprintf(reason, 16, "UNKNOWN_%d", reason_code); tor_snprintf(reason, 16, "UNKNOWN_%d", reason_code);

View File

@ -1806,7 +1806,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
router_get_trusteddirserver_by_digest(conn->identity_digest); router_get_trusteddirserver_by_digest(conn->identity_digest);
char *rejected_hdr = http_get_header(headers, char *rejected_hdr = http_get_header(headers,
"X-Descriptor-Not-New: "); "X-Descriptor-Not-New: ");
int rejected = 0;
if (rejected_hdr) { if (rejected_hdr) {
if (!strcmp(rejected_hdr, "Yes")) { if (!strcmp(rejected_hdr, "Yes")) {
log_info(LD_GENERAL, log_info(LD_GENERAL,
@ -1819,7 +1818,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
* last descriptor, not on the published time of the last * last descriptor, not on the published time of the last
* descriptor. If those are different, that's a bad thing to * descriptor. If those are different, that's a bad thing to
* do. -NM */ * do. -NM */
rejected = 1;
} }
tor_free(rejected_hdr); tor_free(rejected_hdr);
} }

View File

@ -712,7 +712,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
* is the same flag as votes[j]->known_flags[b]. */ * is the same flag as votes[j]->known_flags[b]. */
int *named_flag; /* Index of the flag "Named" for votes[j] */ int *named_flag; /* Index of the flag "Named" for votes[j] */
int *unnamed_flag; /* Index of the flag "Unnamed" for votes[j] */ int *unnamed_flag; /* Index of the flag "Unnamed" for votes[j] */
int chosen_named_idx, chosen_unnamed_idx; int chosen_named_idx;
strmap_t *name_to_id_map = strmap_new(); strmap_t *name_to_id_map = strmap_new();
char conflict[DIGEST_LEN]; char conflict[DIGEST_LEN];
@ -730,7 +730,6 @@ networkstatus_compute_consensus(smartlist_t *votes,
for (i = 0; i < smartlist_len(votes); ++i) for (i = 0; i < smartlist_len(votes); ++i)
unnamed_flag[i] = named_flag[i] = -1; unnamed_flag[i] = named_flag[i] = -1;
chosen_named_idx = smartlist_string_pos(flags, "Named"); chosen_named_idx = smartlist_string_pos(flags, "Named");
chosen_unnamed_idx = smartlist_string_pos(flags, "Unnamed");
/* Build the flag index. */ /* Build the flag index. */
SMARTLIST_FOREACH(votes, networkstatus_t *, v, SMARTLIST_FOREACH(votes, networkstatus_t *, v,

View File

@ -1077,6 +1077,9 @@ request_parse(u8 *packet, ssize_t length, struct evdns_server_port *port, struct
GET16(answers); GET16(answers);
GET16(authority); GET16(authority);
GET16(additional); GET16(additional);
(void)additional;
(void)authority;
(void)answers;
if (flags & 0x8000) return -1; /* Must not be an answer. */ if (flags & 0x8000) return -1; /* Must not be an answer. */
flags &= 0x0110; /* Only RD and CD get preserved. */ flags &= 0x0110; /* Only RD and CD get preserved. */

View File

@ -461,7 +461,7 @@ test_crypto_rng(void)
uint64_t big; uint64_t big;
char *host; char *host;
j = crypto_rand_int(100); j = crypto_rand_int(100);
if (i < 0 || i >= 100) if (j < 0 || j >= 100)
allok = 0; allok = 0;
big = crypto_rand_uint64(U64_LITERAL(1)<<40); big = crypto_rand_uint64(U64_LITERAL(1)<<40);
if (big >= (U64_LITERAL(1)<<40)) if (big >= (U64_LITERAL(1)<<40))
@ -626,6 +626,7 @@ test_crypto_sha(void)
/* Test SHA-1 with a test vector from the specification. */ /* Test SHA-1 with a test vector from the specification. */
i = crypto_digest(data, "abc", 3); i = crypto_digest(data, "abc", 3);
test_memeq_hex(data, "A9993E364706816ABA3E25717850C26C9CD0D89D"); test_memeq_hex(data, "A9993E364706816ABA3E25717850C26C9CD0D89D");
test_eq(i, 0);
/* Test HMAC-SHA-1 with test cases from RFC2202. */ /* Test HMAC-SHA-1 with test cases from RFC2202. */