diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-07-09 10:14:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-07-09 10:14:43 -0400 |
commit | 4a604d99382e4aad3df257e265c852f306f7bc7f (patch) | |
tree | 2e78688da161f764cf8e6c3b579cd9ad152bc635 | |
parent | d3894dc34b66fc5090b674ff850071aaf319d1c8 (diff) | |
parent | 8b53dfc3626f293f821b8e8afe88cca62224f20b (diff) | |
download | tor-4a604d99382e4aad3df257e265c852f306f7bc7f.tar.gz tor-4a604d99382e4aad3df257e265c852f306f7bc7f.zip |
Merge branch 'maint-0.2.9' into maint-0.3.2
-rw-r--r-- | changes/bug26269 | 5 | ||||
-rw-r--r-- | src/or/router.c | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/changes/bug26269 b/changes/bug26269 new file mode 100644 index 0000000000..73dcdbf5c5 --- /dev/null +++ b/changes/bug26269 @@ -0,0 +1,5 @@ + o Minor bugfixes (compilation): + - Fix a compilation warning on some versions of GCC when + building code that calls routerinfo_get_my_routerinfo() twice, + assuming that the second call will succeed if the first one did. + Fixes bug 26269; bugfix on 0.2.8.2-alpha. diff --git a/src/or/router.c b/src/or/router.c index cacd1132a7..854eaa71a9 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1963,10 +1963,11 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) MOCK_IMPL(int, router_my_exit_policy_is_reject_star,(void)) { - if (!router_get_my_routerinfo()) /* make sure routerinfo exists */ + const routerinfo_t *me = router_get_my_routerinfo(); + if (!me) /* make sure routerinfo exists */ return -1; - return router_get_my_routerinfo()->policy_is_reject_star; + return me->policy_is_reject_star; } /** Return true iff I'm a server and <b>digest</b> is equal to @@ -2535,10 +2536,11 @@ check_descriptor_bandwidth_changed(time_t now) { static time_t last_changed = 0; uint64_t prev, cur; - if (!router_get_my_routerinfo()) + const routerinfo_t *my_ri = router_get_my_routerinfo(); + if (!my_ri) /* make sure routerinfo exists */ return; - prev = router_get_my_routerinfo()->bandwidthcapacity; + prev = my_ri->bandwidthcapacity; cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess(); if ((prev != cur && (!prev || !cur)) || cur > prev*2 || @@ -2589,14 +2591,15 @@ check_descriptor_ipaddress_changed(time_t now) const or_options_t *options = get_options(); const char *method = NULL; char *hostname = NULL; + const routerinfo_t *my_ri = router_get_my_routerinfo(); (void) now; - if (router_get_my_routerinfo() == NULL) + if (my_ri == NULL) /* make sure routerinfo exists */ return; /* XXXX ipv6 */ - prev = router_get_my_routerinfo()->addr; + prev = my_ri->addr; if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname) < 0) { log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); return; |