From 93b45bb2e4c511f2d9a9a7552d74e1d921b0bf76 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 16 Mar 2018 08:44:35 -0700 Subject: [PATCH] Make sure that assert() expressions do not have side effects Assert statements are compiled out if NDEBUG is defined. Hence make sure that the expressions passed to assert do not have side effects. Signed-off-by: Bart Van Assche --- io_u.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index 01b36938..84d93155 100644 --- a/io_u.c +++ b/io_u.c @@ -1558,6 +1558,7 @@ bool queue_full(const struct thread_data *td) struct io_u *__get_io_u(struct thread_data *td) { struct io_u *io_u = NULL; + int ret; if (td->stop_io) return NULL; @@ -1594,7 +1595,8 @@ again: * return one */ assert(!(td->flags & TD_F_CHILD)); - assert(!pthread_cond_wait(&td->free_cond, &td->io_u_lock)); + ret = pthread_cond_wait(&td->free_cond, &td->io_u_lock); + assert(ret == 0); goto again; } -- 2.25.1