Merge remote-tracking branch 'sebastian/bug13993'

This commit is contained in:
Nick Mathewson 2015-02-06 15:42:53 -05:00
commit e36faeec1d
6 changed files with 17 additions and 7 deletions

4
changes/bug13993 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (logging):
- Don't log messages to stdout twice when starting up. Fixes bug
13993; bugfix on 0.2.6.1-alpha.

View File

@ -1062,6 +1062,12 @@ flush_log_messages_from_startup(void)
if (! logfile_wants_message(lf, msg->severity, msg->domain)) if (! logfile_wants_message(lf, msg->severity, msg->domain))
continue; continue;
/* We configure a temporary startup log that goes to stdout, so we
* shouldn't replay to stdout/stderr*/
if (lf->fd == STDOUT_FILENO || lf->fd == STDERR_FILENO) {
continue;
}
logfile_deliver(lf, msg->fullmsg, strlen(msg->fullmsg), msg->msg, logfile_deliver(lf, msg->fullmsg, strlen(msg->fullmsg), msg->msg,
msg->domain, msg->severity, &callbacks_deferred); msg->domain, msg->severity, &callbacks_deferred);
} }

View File

@ -1601,7 +1601,6 @@ connection_init_accepted_conn(connection_t *conn,
return 0; return 0;
} }
static int static int
connection_connect_sockaddr(connection_t *conn, connection_connect_sockaddr(connection_t *conn,
const struct sockaddr *sa, const struct sockaddr *sa,
@ -1688,11 +1687,10 @@ connection_connect_sockaddr(connection_t *conn,
*socket_error = SOCK_ERRNO(ENOBUFS); *socket_error = SOCK_ERRNO(ENOBUFS);
return -1; return -1;
} }
return inprogress ? 0 : 1; return inprogress ? 0 : 1;
} }
/** Take conn, make a nonblocking socket; try to connect to /** Take conn, make a nonblocking socket; try to connect to
* addr:port (they arrive in *host order*). If fail, return -1 and if * addr:port (they arrive in *host order*). If fail, return -1 and if
* applicable put your best guess about errno into *<b>socket_error</b>. * applicable put your best guess about errno into *<b>socket_error</b>.

View File

@ -1886,13 +1886,15 @@ circuit_describe_status_for_controller(origin_circuit_t *circ)
if (circ->socks_username_len > 0) { if (circ->socks_username_len > 0) {
char* socks_username_escaped = esc_for_log_len(circ->socks_username, char* socks_username_escaped = esc_for_log_len(circ->socks_username,
(size_t) circ->socks_username_len); (size_t) circ->socks_username_len);
smartlist_add_asprintf(descparts, "SOCKS_USERNAME=%s", socks_username_escaped); smartlist_add_asprintf(descparts, "SOCKS_USERNAME=%s",
socks_username_escaped);
tor_free(socks_username_escaped); tor_free(socks_username_escaped);
} }
if (circ->socks_password_len > 0) { if (circ->socks_password_len > 0) {
char* socks_password_escaped = esc_for_log_len(circ->socks_password, char* socks_password_escaped = esc_for_log_len(circ->socks_password,
(size_t) circ->socks_password_len); (size_t) circ->socks_password_len);
smartlist_add_asprintf(descparts, "SOCKS_PASSWORD=%s", socks_password_escaped); smartlist_add_asprintf(descparts, "SOCKS_PASSWORD=%s",
socks_password_escaped);
tor_free(socks_password_escaped); tor_free(socks_password_escaped);
} }

View File

@ -106,7 +106,8 @@ test_onion_handshake(void *arg)
/* client handshake 2 */ /* client handshake 2 */
memset(c_keys, 0, 40); memset(c_keys, 0, 40);
tt_assert(! onion_skin_TAP_client_handshake(c_dh, s_buf, c_keys, 40, NULL)); tt_assert(! onion_skin_TAP_client_handshake(c_dh, s_buf, c_keys,
40, NULL));
tt_mem_op(c_keys,OP_EQ, s_keys, 40); tt_mem_op(c_keys,OP_EQ, s_keys, 40);
memset(s_buf, 0, 40); memset(s_buf, 0, 40);

View File

@ -3079,7 +3079,6 @@ test_dir_packages(void *arg)
ADD(2, "cbc 99.1.11.1.2 http://example.com/ cubehash=ahooy"); ADD(2, "cbc 99.1.11.1.2 http://example.com/ cubehash=ahooy");
ADD(2, "cbc 99.1.11.1.2 http://example.com/ cubehash=ahooy"); ADD(2, "cbc 99.1.11.1.2 http://example.com/ cubehash=ahooy");
res = compute_consensus_package_lines(votes); res = compute_consensus_package_lines(votes);
tt_assert(res); tt_assert(res);
tt_str_op(res, ==, tt_str_op(res, ==,