public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Yevgeny Kliteynik <kliteyn-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
	Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] osmtest/osmt_slvl_vl_arb.c: handling fopen() failure
Date: Tue, 7 Sep 2010 18:07:13 +0300	[thread overview]
Message-ID: <4C865521.4080600@mellanox.co.il> (raw)


Signed-off-by: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
 opensm/osmtest/osmt_slvl_vl_arb.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/opensm/osmtest/osmt_slvl_vl_arb.c b/opensm/osmtest/osmt_slvl_vl_arb.c
index d3919fb..d4a08ff 100644
--- a/opensm/osmtest/osmt_slvl_vl_arb.c
+++ b/opensm/osmtest/osmt_slvl_vl_arb.c
@@ -489,6 +489,12 @@ osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG_ENTER(&p_osmt->log);

 	fh = fopen("qos.txt", "w");
+	if (!fh) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0474: "
+			"Failed to open file qos.txt for writing\n");
+		status = IB_ERROR;
+		goto Exit;
+	}

 	/* go over all ports in the subnet */
 	status = osmt_query_all_ports_vl_arb(p_osmt, fh);
@@ -520,7 +526,8 @@ osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt)
 	}

 Exit:
-	fclose(fh);
+	if (fh)
+		fclose(fh);
 	OSM_LOG_EXIT(&p_osmt->log);
 	return status;
 }
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-09-07 15:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07 15:07 Yevgeny Kliteynik [this message]
     [not found] ` <4C865521.4080600-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2010-09-09 14:48   ` [PATCH] osmtest/osmt_slvl_vl_arb.c: handling fopen() failure Sasha Khapyorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C865521.4080600@mellanox.co.il \
    --to=kliteyn-vpraknaxozvs1mouv/rt9w@public.gmane.org \
    --cc=kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox