summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug152116
-rw-r--r--src/common/compat_pthreads.c8
-rw-r--r--src/or/control.c4
-rw-r--r--src/or/rendservice.c3
4 files changed, 15 insertions, 6 deletions
diff --git a/changes/bug15211 b/changes/bug15211
new file mode 100644
index 0000000000..24c189dbfd
--- /dev/null
+++ b/changes/bug15211
@@ -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.
+
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index 246076b276..70259a8a53 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -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();
}
diff --git a/src/or/control.c b/src/or/control.c
index e25c3b2954..819a57f214 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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. */
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 036869650c..77eaea0ed9 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -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;