public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OpenSM Ignore invalid command line option -t 0
@ 2011-03-20  7:16 Tamir Ronen
       [not found] ` <4D85A9B3.3080601-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Tamir Ronen @ 2011-03-20  7:16 UTC (permalink / raw)
  To: alexne-VPRAkNaXOzVWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


>From acc805cdf65e12e2cee9bfbf360a176c55a5949f Mon Sep 17 00:00:00 2001
From: Tamir Ronen <tamirr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date: Thu, 17 Mar 2011 15:21:43 +0200
Subject: [PATCH] Ignore command line option -t 0

If the timeout specified in the command line option -t equals zero,
Print an error message and ignore it.
---
 opensm/main.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

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':
-- 
1.5.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OpenSM Ignore invalid command line option -t 0
       [not found] ` <4D85A9B3.3080601-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2011-03-21 14:03   ` Alex Netes
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Netes @ 2011-03-21 14:03 UTC (permalink / raw)
  To: Tamir Ronen; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 09:16 Sun 20 Mar     , Tamir Ronen wrote:
> 
> From acc805cdf65e12e2cee9bfbf360a176c55a5949f Mon Sep 17 00:00:00 2001
> From: Tamir Ronen <tamirr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Date: Thu, 17 Mar 2011 15:21:43 +0200
> Subject: [PATCH] Ignore command line option -t 0
> 
> If the timeout specified in the command line option -t equals zero,
> Print an error message and ignore it.
> ---

Applied. Thanks.

Also fixed description in the man/opensm.8.in
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-21 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-20  7:16 [PATCH] OpenSM Ignore invalid command line option -t 0 Tamir Ronen
     [not found] ` <4D85A9B3.3080601-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-03-21 14:03   ` Alex Netes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox