Skip to contentSkip to conversation

opensm/osm_sa.c: enhance opensm_dump_to_file() to accept full path file name

PATCH New Yevgeny Kliteynik 1 participant 1 message Apr 8, 2010 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/osm_sa.c: enhance opensm_dump_to_file() to accept full path file name

Hi Sasha,

Small patch that enhances opensm_dump_to_file() function and allows it to accept full path file names as argument.

---
 opensm/opensm/osm_sa.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
opensm/opensm/osm_sa.c +7 -2
index 3473e4c..8aab548 100644
@@ -510,8 +510,13 @@ opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
 	char path[1024];
 	FILE *file;
 
-	snprintf(path, sizeof(path), "%s/%s",
-		 p_osm->subn.opt.dump_files_dir, file_name);
+	if (*file_name == '/')
+		/* file name was provided as an absolute path */
+		snprintf(path, sizeof(path), "%s", file_name);
+	else
+		/* file name is relative to dump_files_dir */
+		snprintf(path, sizeof(path), "%s/%s",
+			 p_osm->subn.opt.dump_files_dir, file_name);
 
 	file = fopen(path, "w");
 	if (!file) {
Signature · 6 lines
1.5.1.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