@@ -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) {