diff mbox

OpenSM Ignore invalid command line option -t 0

Message ID 4D85A9B3.3080601@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Tamir Ronen March 20, 2011, 7:16 a.m. UTC
None
diff mbox

Patch

diff --git a/opensm/main.c b/opensm/main.c
index 756fe6f..9d489f2 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -249,7 +249,7 @@  static void show_usage(void)
 	printf("--timeout, -t <milliseconds>\n"
 	       "          This option specifies the time in milliseconds\n"
 	       "          used for transaction timeouts.\n"
-	       "          Specifying -t 0 disables timeouts.\n"
+	       "          Specifying -t 0 is invalid.\n"
 	       "          Without -t, OpenSM defaults to a timeout value of\n"
 	       "          200 milliseconds.\n\n");
 	printf("--retries <number>\n"
@@ -746,9 +746,15 @@  int main(int argc, char *argv[])
 			break;
 
 		case 't':
-			opt.transaction_timeout = strtoul(optarg, NULL, 0);
-			printf(" Transaction timeout = %u\n",
-			       opt.transaction_timeout);
+			val = strtoul(optarg, NULL, 0);
+			if(val == 0)
+				fprintf(stderr,
+					"ERROR: timeout value 0 is invalid. Ignoring it.\n");
+			else {
+				opt.transaction_timeout = val;
+				printf(" Transaction timeout = %u\n",
+					   opt.transaction_timeout);
+			}
 			break;
 
 		case 'n':