From 6d8b614729bc8011d68a7234a81190ec11f6cd5f Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Fri, 6 Feb 2015 21:17:48 +0100 Subject: Avoid logging startup messages twice --- changes/bug13993 | 4 ++++ src/common/log.c | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 changes/bug13993 diff --git a/changes/bug13993 b/changes/bug13993 new file mode 100644 index 0000000000..bf99559822 --- /dev/null +++ b/changes/bug13993 @@ -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. + diff --git a/src/common/log.c b/src/common/log.c index bbad7f1dac..e8cc30c312 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -1062,6 +1062,12 @@ flush_log_messages_from_startup(void) if (! logfile_wants_message(lf, msg->severity, msg->domain)) 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, msg->domain, msg->severity, &callbacks_deferred); } -- cgit v1.2.3-54-g00ecf From e0c3de40ad557be4ed059e93695391e44aa7a16c Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Fri, 6 Feb 2015 21:36:40 +0100 Subject: Fix check-spaces complaints --- src/or/connection.c | 4 +--- src/or/control.c | 6 ++++-- src/test/test.c | 3 ++- src/test/test_dir.c | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index 0ce4f72209..79ae178a56 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1601,7 +1601,6 @@ connection_init_accepted_conn(connection_t *conn, return 0; } - static int connection_connect_sockaddr(connection_t *conn, const struct sockaddr *sa, @@ -1688,11 +1687,10 @@ connection_connect_sockaddr(connection_t *conn, *socket_error = SOCK_ERRNO(ENOBUFS); return -1; } - return inprogress ? 0 : 1; + return inprogress ? 0 : 1; } - /** Take conn, make a nonblocking socket; try to connect to * addr:port (they arrive in *host order*). If fail, return -1 and if * applicable put your best guess about errno into *socket_error. diff --git a/src/or/control.c b/src/or/control.c index 24e1479b50..064b745c9f 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1886,13 +1886,15 @@ circuit_describe_status_for_controller(origin_circuit_t *circ) if (circ->socks_username_len > 0) { char* socks_username_escaped = esc_for_log_len(circ->socks_username, (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); } if (circ->socks_password_len > 0) { char* socks_password_escaped = esc_for_log_len(circ->socks_password, (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); } diff --git a/src/test/test.c b/src/test/test.c index 85a7ad6c7c..d57a018fd6 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -106,7 +106,8 @@ test_onion_handshake(void *arg) /* client handshake 2 */ 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); memset(s_buf, 0, 40); diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 849bbdbef6..a949f5de73 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -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"); - res = compute_consensus_package_lines(votes); tt_assert(res); tt_str_op(res, ==, -- cgit v1.2.3-54-g00ecf