From 55a04f154525aff2b720e61b59d5d27548b3af60 Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Thu, 11 Feb 2016 09:25:03 +0100 Subject: [PATCH] mtapi_c: set result to MTAPI_NULL on error in mtapi_group_wait_any --- mtapi_c/src/embb_mtapi_group_t.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mtapi_c/src/embb_mtapi_group_t.c b/mtapi_c/src/embb_mtapi_group_t.c index 9e3b0a5..1a7e064 100644 --- a/mtapi_c/src/embb_mtapi_group_t.c +++ b/mtapi_c/src/embb_mtapi_group_t.c @@ -279,6 +279,7 @@ void mtapi_group_wait_any( MTAPI_IN mtapi_timeout_t timeout, MTAPI_OUT mtapi_status_t* status) { mtapi_status_t local_status = MTAPI_ERR_UNKNOWN; + void* local_result = MTAPI_NULL; embb_mtapi_log_trace("mtapi_group_wait_any() called\n"); @@ -335,10 +336,7 @@ void mtapi_group_wait_any( } /* was there a timeout, or is there a result? */ if (MTAPI_NULL != local_task) { - /* store result */ - if (MTAPI_NULL != result) { - *result = local_task->result_buffer; - } + local_result = local_task->result_buffer; /* return error code set by the task */ local_status = local_task->error_code; @@ -356,6 +354,11 @@ void mtapi_group_wait_any( local_status = MTAPI_ERR_NODE_NOTINIT; } + /* store result */ + if (MTAPI_NULL != result) { + *result = local_result; + } + mtapi_status_set(status, local_status); embb_mtapi_log_trace("mtapi_group_wait_any() returns\n"); } -- libgit2 0.26.0