Merge remote-tracking branch 'sebastian/bug15211'

This commit is contained in:
Nick Mathewson 2015-03-13 09:39:04 -04:00
commit 833b6d30be
4 changed files with 15 additions and 6 deletions

6
changes/bug15211 Normal file
View File

@ -0,0 +1,6 @@
o Minor bugfixes:
- Remove side-effects from tor_assert() calls. This was harmless,
because we never disable assertions, but it is bad style and
unnecessary. Fixes bug 15211; bugfix on 0.2.5.5, 0.2.2.36, and
0.2.0.10.

View File

@ -276,14 +276,16 @@ void
tor_threads_init(void)
{
if (!threads_initialized) {
int ret;
pthread_mutexattr_init(&attr_recursive);
pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE);
tor_assert(0==pthread_attr_init(&attr_detached));
ret = pthread_attr_init(&attr_detached);
tor_assert(ret == 0);
#ifndef PTHREAD_CREATE_DETACHED
#define PTHREAD_CREATE_DETACHED 1
#endif
tor_assert(0==pthread_attr_setdetachstate(&attr_detached,
PTHREAD_CREATE_DETACHED));
ret = pthread_attr_setdetachstate(&attr_detached, PTHREAD_CREATE_DETACHED);
tor_assert(ret == 0);
threads_initialized = 1;
set_main_thread();
}

View File

@ -3102,8 +3102,8 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
tor_free(client_nonce);
return -1;
}
tor_assert(!crypto_rand(server_nonce, SAFECOOKIE_SERVER_NONCE_LEN));
int fail = crypto_rand(server_nonce, SAFECOOKIE_SERVER_NONCE_LEN);
tor_assert(!fail);
/* Now compute and send the server-to-controller response, and the
* server's nonce. */

View File

@ -3320,7 +3320,8 @@ rend_services_introduce(void)
intro = tor_malloc_zero(sizeof(rend_intro_point_t));
intro->extend_info = extend_info_from_node(node, 0);
intro->intro_key = crypto_pk_new();
tor_assert(!crypto_pk_generate_key(intro->intro_key));
int fail = crypto_pk_generate_key(intro->intro_key);
tor_assert(!fail);
intro->time_published = -1;
intro->time_to_expire = -1;
intro->time_expiring = -1;