The config file already has a check for 0.  This adds the same check to the
console "perfmgr sweep_time" command.

Signed-off-by: Ira Weiny <wei...@llnl.gov>
---
 opensm/osm_console.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index ad3a4d7..5b602d1 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -1471,11 +1471,20 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * 
p_osm, FILE * out)
                        p_cmd = next_token(p_last);
                        if (p_cmd) {
                                uint16_t time_s = atoi(p_cmd);
-                               osm_perfmgr_set_sweep_time_s(&p_osm->perfmgr,
-                                                            time_s);
+                               if (time_s < 1)
+                                       fprintf(out,
+                                               "sweep_time requires a "
+                                               "positive time period "
+                                               "(in seconds) to be "
+                                               "specified\n");
+                               else
+                                       osm_perfmgr_set_sweep_time_s(
+                                                       &p_osm->perfmgr,
+                                                       time_s);
                        } else {
                                fprintf(out,
-                                       "sweep_time requires a time period (in 
seconds) to be specified\n");
+                                       "sweep_time requires a time period "
+                                       "(in seconds) to be specified\n");
                        }
                } else {
                        fprintf(out, "\"%s\" option not found\n", p_cmd);
-- 
1.7.1

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

Reply via email to