Skip to contentSkip to conversation

osmtest/osmt_slvl_vl_arb.c: handling fopen() failure

PATCH Applied Yevgeny Kliteynik 2 participants 2 messages Sep 7, 2010 – Sep 9, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osmtest/osmt_slvl_vl_arb.c: handling fopen() failure

---
 opensm/osmtest/osmt_slvl_vl_arb.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
opensm/osmtest/osmt_slvl_vl_arb.c +8 -1
index d3919fb..d4a08ff 100644
@@ -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;
 }
Signature · 6 lines
1.6.2.4

--
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

A message that is not in the archive (sent off-list or not yet received): 4C865521.4080600-VPRAkNaXOzVS1MOuV/[email protected]