From a68867b150eabfa820a12f8a9f1b4cf5b9dbd8e9 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 26 Oct 2011 17:11:52 -0400 Subject: [PATCH 1/2] manually backport a5232e0c4c --- changes/bug3208b | 4 ++++ src/or/circuitbuild.c | 3 --- src/or/command.c | 1 + src/or/control.c | 2 -- src/or/directory.c | 2 -- src/or/dirvote.c | 3 +-- src/or/eventdns.c | 3 +++ src/or/test.c | 3 ++- 8 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 changes/bug3208b diff --git a/changes/bug3208b b/changes/bug3208b new file mode 100644 index 0000000000..5e0489b223 --- /dev/null +++ b/changes/bug3208b @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Fix warnings from GCC 4.6's "-Wunused-but-set-variable" option. + Fixes bug 3208. + diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 208a9cb11b..aa845332b5 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2297,7 +2297,6 @@ entry_guards_compute_status(void) { time_t now; int changed = 0; - int severity = LOG_DEBUG; or_options_t *options; digestmap_t *reasons; if (! entry_guards) @@ -2325,8 +2324,6 @@ entry_guards_compute_status(void) if (remove_dead_entry_guards()) changed = 1; - severity = changed ? LOG_DEBUG : LOG_INFO; - if (changed) { SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) { const char *reason = digestmap_get(reasons, entry->identity); diff --git a/src/or/command.c b/src/or/command.c index 9269456805..61b898cead 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -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 * trustworthy. */ + (void)my_apparent_addr; if (connection_or_set_state_open(conn)<0) connection_mark_for_close(TO_CONN(conn)); diff --git a/src/or/control.c b/src/or/control.c index f91afafeee..3ffe10bf2d 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -2999,7 +2999,6 @@ control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t tp, { const char *status; char extended_buf[96]; - int providing_reason=0; if (!EVENT_IS_INTERESTING(EVENT_CIRCUIT_STATUS)) return 0; 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); char *reason = NULL; size_t n=strlen(extended_buf); - providing_reason=1; if (!reason_str) { reason = tor_malloc(16); tor_snprintf(reason, 16, "UNKNOWN_%d", reason_code); diff --git a/src/or/directory.c b/src/or/directory.c index 9f9b2c1577..0c849cade4 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1806,7 +1806,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn) router_get_trusteddirserver_by_digest(conn->identity_digest); char *rejected_hdr = http_get_header(headers, "X-Descriptor-Not-New: "); - int rejected = 0; if (rejected_hdr) { if (!strcmp(rejected_hdr, "Yes")) { 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 * descriptor. If those are different, that's a bad thing to * do. -NM */ - rejected = 1; } tor_free(rejected_hdr); } diff --git a/src/or/dirvote.c b/src/or/dirvote.c index f1381988c9..e38c210a45 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -712,7 +712,7 @@ networkstatus_compute_consensus(smartlist_t *votes, * is the same flag as votes[j]->known_flags[b]. */ int *named_flag; /* Index of the flag "Named" 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(); char conflict[DIGEST_LEN]; @@ -730,7 +730,6 @@ networkstatus_compute_consensus(smartlist_t *votes, for (i = 0; i < smartlist_len(votes); ++i) unnamed_flag[i] = named_flag[i] = -1; chosen_named_idx = smartlist_string_pos(flags, "Named"); - chosen_unnamed_idx = smartlist_string_pos(flags, "Unnamed"); /* Build the flag index. */ SMARTLIST_FOREACH(votes, networkstatus_t *, v, diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 1d93ae048e..ccac458d7a 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -1077,6 +1077,9 @@ request_parse(u8 *packet, ssize_t length, struct evdns_server_port *port, struct GET16(answers); GET16(authority); GET16(additional); + (void)additional; + (void)authority; + (void)answers; if (flags & 0x8000) return -1; /* Must not be an answer. */ flags &= 0x0110; /* Only RD and CD get preserved. */ diff --git a/src/or/test.c b/src/or/test.c index dc71db4e1d..2a37ab976a 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -461,7 +461,7 @@ test_crypto_rng(void) uint64_t big; char *host; j = crypto_rand_int(100); - if (i < 0 || i >= 100) + if (j < 0 || j >= 100) allok = 0; big = crypto_rand_uint64(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. */ i = crypto_digest(data, "abc", 3); test_memeq_hex(data, "A9993E364706816ABA3E25717850C26C9CD0D89D"); + test_eq(i, 0); /* Test HMAC-SHA-1 with test cases from RFC2202. */ From a166f1041444c133d0617d998cba6a1e41c8002f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 23 May 2011 16:59:41 -0400 Subject: [PATCH 2/2] Remove the -F option from tor-resolve. It used to mean "Force": it would tell tor-resolve to ask tor to resolve an address even if it ended with .onion. But when AutomapHostsOnResolve was added, automatically refusing to resolve .onion hosts stopped making sense. So in 0.2.1.16-rc (commit 298dc95dfd8), we made tor-resolve happy to resolve anything. The -F option stayed in, though, even though it didn't do anything. Oddly, it never got documented. Found while fixing GCC 4.6 "set, unused variable" warnings. --- changes/bug3208 | 4 ++++ src/tools/tor-resolve.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changes/bug3208 diff --git a/changes/bug3208 b/changes/bug3208 new file mode 100644 index 0000000000..731c96e20a --- /dev/null +++ b/changes/bug3208 @@ -0,0 +1,4 @@ + o Removed options: + - Remove undocumented option "-F" from tor-resolve: it hasn't done + anything since 0.2.1.16-rc. + diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c index 4d9d57a31c..d467e879c4 100644 --- a/src/tools/tor-resolve.c +++ b/src/tools/tor-resolve.c @@ -319,7 +319,7 @@ main(int argc, char **argv) { uint32_t sockshost; uint16_t socksport = 0, port_option = 0; - int isSocks4 = 0, isVerbose = 0, isReverse = 0, force = 0; + int isSocks4 = 0, isVerbose = 0, isReverse = 0; char **arg; int n_args; struct in_addr a; @@ -349,8 +349,6 @@ main(int argc, char **argv) isSocks4 = 0; else if (!strcmp("-x", arg[0])) isReverse = 1; - else if (!strcmp("-F", arg[0])) - force = 1; else if (!strcmp("-p", arg[0])) { int p; if (n_args < 2) {