[ofw] patch: opensm - better handle bad command line parameters

Tzachi Dar tzachid at mellanox.co.il
Thu Aug 19 08:07:55 PDT 2010


The following patch helps opensm handle bad parameters, such as:

"opensm -"

K:\Users\Administrator>opensm -/
-------------------------------------------------
OpenSM 3.3.3
^C
K:\Users\Administrator>opensm -/\\
-------------------------------------------------
OpenSM 3.3.3
^C
K:\Users\Administrator>opensm -/\\jjj -h

Thanks
Tzachi


Index: main.c
===================================================================
--- main.c             (revision 6291)
+++ main.c          (revision 6292)
@@ -723,9 +723,9 @@
                                default:
                                                break;
                                }
-              } while (next_option != -1);
+             } while (next_option != -1 && next_option != '?');

                if (config_file && osm_subn_parse_conf_file(config_file, &opt) < 0)
                                printf("\nFail to parse config file \'%s\'\n", config_file);
@@ -1077,7 +1077,8 @@
                                case -1:
                                                break;   /* done with option */
                                default:                /* something wrong */
-                                              abort();
+                                             show_usage();
+                                             exit(1);
                                }
                } while (next_option != -1);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100819/38a36c83/attachment.html>


More information about the ofw mailing list