* [PATCH] opensm/osm_sa.c: enhance opensm_dump_to_file() to accept full path file name
@ 2010-04-08 13:14 Yevgeny Kliteynik
0 siblings, 0 replies; only message in thread
From: Yevgeny Kliteynik @ 2010-04-08 13:14 UTC (permalink / raw)
To: Sasha Khapyorsky; +Cc: Linux RDMA
Hi Sasha,
Small patch that enhances opensm_dump_to_file() function
and allows it to accept full path file names as argument.
Signed-off-by: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
opensm/opensm/osm_sa.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 3473e4c..8aab548 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -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) {
--
1.5.1.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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-08 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 13:14 [PATCH] opensm/osm_sa.c: enhance opensm_dump_to_file() to accept full path file name Yevgeny Kliteynik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox