[tor-commits] [tor/master] passing hints as a const pointer to sandbox_getaddrinfo(), also one tor_free macro fails to compile..

nickm at torproject.org nickm at torproject.org
Fri Sep 13 16:31:56 UTC 2013


commit 6a22b29641834cecb446282588f9d47d8678b8b4
Author: Cristian Toader <cristian.matei.toader at gmail.com>
Date:   Fri Sep 6 12:39:56 2013 +0300

    passing hints as a const pointer to sandbox_getaddrinfo(), also one tor_free macro fails to compile..
---
 src/common/address.c |    2 +-
 src/common/sandbox.c |    6 +++---
 src/common/sandbox.h |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/common/address.c b/src/common/address.c
index a46aeb0..f9647b9 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -235,7 +235,7 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = family;
     hints.ai_socktype = SOCK_STREAM;
-    err = sandbox_getaddrinfo(name, hints, &res);
+    err = sandbox_getaddrinfo(name, &hints, &res);
     if (!err) {
       best = NULL;
       for (res_p = res; res_p; res_p = res_p->ai_next) {
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 7e77ea1..e936b62 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -728,7 +728,7 @@ prot_strings(sandbox_cfg_t* cfg)
       memcpy(pr_mem_next, param_val, param_size);
 
       // re-point el parameter to protected
-      tor_free((char*) ((smp_param_t*)el->param)->value);
+      free((char*)((smp_param_t*)el->param)->value);
       ((smp_param_t*)el->param)->value = (intptr_t) pr_mem_next;
       ((smp_param_t*)el->param)->prot = 1;
 
@@ -949,7 +949,7 @@ sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, ...)
 }
 
 int
-sandbox_getaddrinfo(const char *name, struct addrinfo hints,
+sandbox_getaddrinfo(const char *name, const struct addrinfo *hints,
     struct addrinfo **res)
 {
   sb_addr_info_t *el;
@@ -969,7 +969,7 @@ sandbox_getaddrinfo(const char *name, struct addrinfo hints,
   }
 
   if (!sandbox_active) {
-    if (getaddrinfo(name, NULL, &hints, res)) {
+    if (getaddrinfo(name, NULL, hints, res)) {
       log_err(LD_BUG,"(Sandbox) getaddrinfo failed!");
       return -1;
     }
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index 503bb70..ed9caa1 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -133,7 +133,7 @@ typedef struct {
 int sandbox_add_addrinfo(const char *addr);
 
 /** Replacement for getaddrinfo(), using pre-recorded results. */
-int sandbox_getaddrinfo(const char *name, struct addrinfo hints,
+int sandbox_getaddrinfo(const char *name, const struct addrinfo *hints,
     struct addrinfo **res);
 
 /** Use <b>fd</b> to log non-survivable sandbox violations. */





More information about the tor-commits mailing list