From patchwork Tue Oct 9 12:27:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dotan Barak X-Patchwork-Id: 1569881 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E2A9940135 for ; Tue, 9 Oct 2012 12:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754259Ab2JIM2F (ORCPT ); Tue, 9 Oct 2012 08:28:05 -0400 Received: from eu1sys200aog105.obsmtp.com ([207.126.144.119]:53030 "HELO eu1sys200aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752890Ab2JIM2A (ORCPT ); Tue, 9 Oct 2012 08:28:00 -0400 Received: from mtlsws123.lab.mtl.com ([82.166.227.17]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKUHQYS1Si2oJYMm+0zpCdmtlnPpZTHgjb@postini.com; Tue, 09 Oct 2012 12:27:59 UTC Received: from swl021.lab.mtl.com (swl021.lab.mtl.com [10.7.17.21]) by mtlsws123.lab.mtl.com (8.13.8/8.13.8) with ESMTP id q99CRs4x004798; Tue, 9 Oct 2012 14:27:55 +0200 From: Dotan Barak To: sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, Dotan Barak Subject: [PATCH 5/5] [librdmacm] rping: added checks to the return values functions Date: Tue, 9 Oct 2012 14:27:52 +0200 Message-Id: <1349785672-1921-6-git-send-email-dotanb@dev.mellanox.co.il> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1349785672-1921-1-git-send-email-dotanb@dev.mellanox.co.il> References: <1349785672-1921-1-git-send-email-dotanb@dev.mellanox.co.il> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This will make rping to exit with return value other than zero in case of an error. Signed-off-by: Dotan Barak Reviewed-by: Yishai Hadas --- 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: