This will make rping to exit with return value other than zero in case of an error.
Signed-off-by: Dotan Barak <[email protected]> Reviewed-by: Yishai Hadas <[email protected]> --- examples/rping.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/rping.c b/examples/rping.c index 32bd70a..d702592 100644 --- a/examples/rping.c +++ b/examples/rping.c @@ -881,7 +881,14 @@ static int rping_run_server(struct rping_cb *cb) goto err2; } - rping_test_server(cb); + ret = rping_test_server(cb); + if (ret) { + fprintf(stderr, "rping server failed: %d\n", ret); + goto err3; + } + + ret = 0; +err3: rdma_disconnect(cb->child_cm_id); pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); @@ -1049,7 +1056,14 @@ static int rping_run_client(struct rping_cb *cb) goto err2; } - rping_test_client(cb); + ret = rping_test_client(cb); + if (ret) { + fprintf(stderr, "rping client failed: %d\n", ret); + goto err3; + } + + ret = 0; +err3: rdma_disconnect(cb->cm_id); pthread_join(cb->cqthread, NULL); err2: @@ -1189,6 +1203,7 @@ int main(int argc, char *argv[]) cb->cm_channel = rdma_create_event_channel(); if (!cb->cm_channel) { perror("rdma_create_event_channel"); + ret = ENOMEM; goto out; } @@ -1210,7 +1225,7 @@ int main(int argc, char *argv[]) ret = rping_run_client(cb); DEBUG_LOG("destroy cm_id %p\n", cb->cm_id); - rdma_destroy_id(cb->cm_id); + ret = rdma_destroy_id(cb->cm_id); out2: rdma_destroy_event_channel(cb->cm_channel); out: -- 1.7.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
