There is a scenario that fopen will overwrite output variable. Signed-off-by: Alex Netes <ale...@mellanox.com> --- opensm/osm_console.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/opensm/osm_console.c b/opensm/osm_console.c index fad80ad..7003508 100644 --- a/opensm/osm_console.c +++ b/opensm/osm_console.c @@ -1279,6 +1279,8 @@ static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) if (strcmp(p_cmd, "file") == 0) { p_cmd = next_token(p_last); if (p_cmd) { + if (output != out) + fclose(output); output = fopen(p_cmd, "w+"); if (output == NULL) { fprintf(out, -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html