summaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-05-10 16:13:16 +0300
committerrl1987 <rl1987@sdf.lonestar.org>2018-05-10 16:13:16 +0300
commit36f7d0a940bbe8695d5343fccc1a0560a529883a (patch)
tree5351643e28acaaff2e7a9a1d2162fad54095dd96 /src/or/policies.c
parentb8ed6e2ac6226c9cf43d28533c7f7eb3315be150 (diff)
downloadtor-36f7d0a940bbe8695d5343fccc1a0560a529883a.tar.gz
tor-36f7d0a940bbe8695d5343fccc1a0560a529883a.zip
Make _with_err return routerinfo, like old function does
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index 15176a97e4..4d47985ec5 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -2999,9 +2999,8 @@ getinfo_helper_policies(control_connection_t *conn,
smartlist_free(private_policy_strings);
} else if (!strcmp(question, "exit-policy/reject-private/relay")) {
const or_options_t *options = get_options();
- const routerinfo_t *me = NULL;
-
- int err = router_get_my_routerinfo_with_err((routerinfo_t **)&me);
+ int err = 0;
+ const routerinfo_t *me = router_get_my_routerinfo_with_err(&err);
if (!me) {
*errmsg = routerinfo_errno_to_string(err);
@@ -3043,8 +3042,13 @@ getinfo_helper_policies(control_connection_t *conn,
int include_ipv4 = 0;
int include_ipv6 = 0;
- const routerinfo_t *me = NULL;
- int err = router_get_my_routerinfo_with_err((routerinfo_t **)&me);
+ int err = 0;
+ const routerinfo_t *me = router_get_my_routerinfo_with_err(&err);
+
+ if (!me) {
+ *errmsg = routerinfo_errno_to_string(err);
+ return routerinfo_err_is_transient(err) ? -1 : 0;
+ }
if (!strcmp(question, "exit-policy/ipv4")) {
include_ipv4 = 1;
@@ -3056,13 +3060,8 @@ getinfo_helper_policies(control_connection_t *conn,
return 0; /* No such key. */
}
- if (!me) {
- *errmsg = routerinfo_errno_to_string(err);
- return routerinfo_err_is_transient(err) ? -1 : 0;
- } else {
- *answer = router_dump_exit_policy_to_string(me,include_ipv4,
- include_ipv6);
- }
+ *answer = router_dump_exit_policy_to_string(me,include_ipv4,
+ include_ipv6);
}
return 0;