[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix some bugs that did not allow compilation on Windows.



commit b9551fd0741434e9d0917355d67164775eb25fbe
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Tue Aug 21 20:56:30 2012 +0300

    Fix some bugs that did not allow compilation on Windows.
---
 src/common/util.c                       |   14 +++++++-------
 src/tools/tor-fw-helper/tor-fw-helper.c |   20 +++++---------------
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index 25ddcc1..fa8fb53 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -4381,17 +4381,17 @@ tor_get_lines_from_handle(HANDLE *handle,
   char stdout_buf[600] = {0};
   smartlist_t *lines = NULL;
 
-  tor_assert(stream_status);
+  tor_assert(stream_status_out);
 
-  *stream_status = IO_STREAM_TERM;
+  *stream_status_out = IO_STREAM_TERM;
 
   pos = tor_read_all_handle(handle, stdout_buf, sizeof(stdout_buf) - 1, NULL);
   if (pos < 0) {
-    *stream_status = IO_STREAM_TERM;
+    *stream_status_out = IO_STREAM_TERM;
     return NULL;
   }
   if (pos == 0) {
-    *stream_status = IO_STREAM_EAGAIN;
+    *stream_status_out = IO_STREAM_EAGAIN;
     return NULL;
   }
 
@@ -4408,7 +4408,7 @@ tor_get_lines_from_handle(HANDLE *handle,
   SMARTLIST_FOREACH(lines, char *, line,
                     SMARTLIST_REPLACE_CURRENT(lines, line, tor_strdup(line)));
 
-  *stream_status = IO_STREAM_OKAY;
+  *stream_status_out = IO_STREAM_OKAY;
 
   return lines;
 }
@@ -4461,8 +4461,8 @@ log_from_handle(HANDLE *pipe, int severity)
 #else
 
 /** Return a smartlist containing lines outputted from
- *  <b>handle</b>. Return NULL on error, and set <b>stream_status</b>
- *  appropriately. */
+ *  <b>handle</b>. Return NULL on error, and set
+ *  <b>stream_status_out</b> appropriately. */
 smartlist_t *
 tor_get_lines_from_handle(FILE *handle, enum stream_status *stream_status_out)
 {
diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c
index d02b757..4efe515 100644
--- a/src/tools/tor-fw-helper/tor-fw-helper.c
+++ b/src/tools/tor-fw-helper/tor-fw-helper.c
@@ -353,28 +353,18 @@ parse_port(const char *arg)
 /** Report a failure of epic proportions: We didn't manage to
  *  initialize any port forwarding backends. */
 static void
-report_full_fail(const smartlist_t *ports_to_forward, backends_t *backends)
+report_full_fail(const smartlist_t *ports_to_forward)
 {
-  char *list_of_backends_str = NULL;
-  char *fail_msg = NULL;
-
   if (!ports_to_forward)
     return;
 
-  list_of_backends_str = get_list_of_backends_string(backends);
-  tor_asprintf(&fail_msg,
-               "Port forwarding backends (%s) could not be initialized.",
-               list_of_backends_str);
-
   SMARTLIST_FOREACH_BEGIN(ports_to_forward,
                           const port_to_forward_t *, port_to_forward) {
     tor_fw_helper_report_port_fw_fail(port_to_forward->internal_port,
                                       port_to_forward->external_port,
-                                      fail_msg);
+                                      "All backends (NAT-PMP, UPnP) failed "
+                                      "to initialize!"); /* XXX hardcoded */
   } SMARTLIST_FOREACH_END(port_to_forward);
-
-  tor_free(list_of_backends_str);
-  tor_free(fail_msg);
 }
 
 int
@@ -481,8 +471,8 @@ main(int argc, char **argv)
   r = init_backends(&tor_fw_options, &backend_state);
   if (!r) { // all backends failed:
     // report our failure
-    report_full_fail(tor_fw_options.ports_to_forward, &backend_state);
-    fprintf(stderr, "V: tor-fw-helper: All backends failed.\n");
+    report_full_fail(tor_fw_options.ports_to_forward);
+    fprintf(stderr, "tor-fw-helper: All backends failed.\n");
     exit(1);
   } else { // some backends succeeded:
     fprintf(stderr, "tor-fw-helper: %i NAT traversal helper(s) loaded\n", r);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits