commit d3b9b5a3dd6a6068557fc53176c41bc917100be2 Author: Nick Mathewson nickm@torproject.org Date: Thu Apr 12 12:38:46 2018 -0400
Remove windows log_from_handle as unused.
This function was only used by PortForwardingHelper, which was removed in 9df110cd72. Its presence caused warnings on windows. --- src/common/util.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-)
diff --git a/src/common/util.c b/src/common/util.c index 065b3245f..041e7aee3 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -5156,51 +5156,6 @@ tor_get_lines_from_handle, (HANDLE *handle, return lines; }
-/** Read from stream, and send lines to log at the specified log level. - * Returns -1 if there is a error reading, and 0 otherwise. - * If the generated stream is flushed more often than on new lines, or - * a read exceeds 256 bytes, lines will be truncated. This should be fixed, - * along with the corresponding problem on *nix (see bug #2045). - */ -static int -log_from_handle(HANDLE *pipe, int severity) -{ - char buf[256]; - int pos; - smartlist_t *lines; - - pos = tor_read_all_handle(pipe, buf, sizeof(buf) - 1, NULL); - if (pos < 0) { - /* Error */ - log_warn(LD_GENERAL, "Failed to read data from subprocess"); - return -1; - } - - if (0 == pos) { - /* There's nothing to read (process is busy or has exited) */ - log_debug(LD_GENERAL, "Subprocess had nothing to say"); - return 0; - } - - /* End with a null even if there isn't a \r\n at the end */ - /* TODO: What if this is a partial line? */ - buf[pos] = '\0'; - log_debug(LD_GENERAL, "Subprocess had %d bytes to say", pos); - - /* Split up the buffer */ - lines = smartlist_new(); - tor_split_lines(lines, buf, pos); - - /* Log each line */ - SMARTLIST_FOREACH(lines, char *, line, - { - log_fn(severity, LD_GENERAL, "Port forwarding helper says: %s", line); - }); - smartlist_free(lines); - - return 0; -} - #else /* !(defined(_WIN32)) */
/** Return a smartlist containing lines outputted from
tor-commits@lists.torproject.org