All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xl: fix off-by-one mistake in block-attach handler
@ 2010-09-21 11:13 Jan Beulich
  2010-09-21 15:14 ` Ian Jackson
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2010-09-21 11:13 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- 2010-09-20.orig/tools/libxl/xl_cmdimpl.c	2010-09-15 17:59:07.000000000 +0200
+++ 2010-09-20/tools/libxl/xl_cmdimpl.c	2010-09-21 12:06:58.000000000 +0200
@@ -4280,7 +4280,7 @@ int main_blockattach(int argc, char **ar
     }
     disk.virtpath = argv[optind+2];
     disk.unpluggable = 1;
-    disk.readwrite = ((argc-optind <= 2) || (argv[optind+3][0] == 'w'));
+    disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
 
     if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);




[-- Attachment #2: xl-block-attach.patch --]
[-- Type: text/plain, Size: 654 bytes --]

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- 2010-09-20.orig/tools/libxl/xl_cmdimpl.c	2010-09-15 17:59:07.000000000 +0200
+++ 2010-09-20/tools/libxl/xl_cmdimpl.c	2010-09-21 12:06:58.000000000 +0200
@@ -4280,7 +4280,7 @@ int main_blockattach(int argc, char **ar
     }
     disk.virtpath = argv[optind+2];
     disk.unpluggable = 1;
-    disk.readwrite = ((argc-optind <= 2) || (argv[optind+3][0] == 'w'));
+    disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
 
     if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH] xl: fix off-by-one mistake in block-attach handler
  2010-09-21 11:13 [PATCH] xl: fix off-by-one mistake in block-attach handler Jan Beulich
@ 2010-09-21 15:14 ` Ian Jackson
  2010-09-21 16:05   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2010-09-21 15:14 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

Jan Beulich writes ("[Xen-devel] [PATCH] xl: fix off-by-one mistake in block-attach handler"):
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> --- 2010-09-20.orig/tools/libxl/xl_cmdimpl.c	2010-09-15 17:59:07.000000000 +0200
> +++ 2010-09-20/tools/libxl/xl_cmdimpl.c	2010-09-21 12:06:58.000000000 +0200
> @@ -4280,7 +4280,7 @@ int main_blockattach(int argc, char **ar
>      }
>      disk.virtpath = argv[optind+2];
>      disk.unpluggable = 1;
> -    disk.readwrite = ((argc-optind <= 2) || (argv[optind+3][0] == 'w'));
> +    disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));

This idiom is pretty nasty.  Perhaps we should rewrite it to:

  +    disk.readwrite = (argc-optind > 3) ? (argv[optind+3][0] == 'w') : 1;

or some such ?

Ian.

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

* Re: [PATCH] xl: fix off-by-one mistake in block-attach handler
  2010-09-21 15:14 ` Ian Jackson
@ 2010-09-21 16:05   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2010-09-21 16:05 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

>>> On 21.09.10 at 17:14, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:
> Jan Beulich writes ("[Xen-devel] [PATCH] xl: fix off-by-one mistake in 
> block-attach handler"):
>> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>> 
>> --- 2010-09-20.orig/tools/libxl/xl_cmdimpl.c	2010-09-15 17:59:07.000000000 +0200
>> +++ 2010-09-20/tools/libxl/xl_cmdimpl.c	2010-09-21 12:06:58.000000000 +0200
>> @@ -4280,7 +4280,7 @@ int main_blockattach(int argc, char **ar
>>      }
>>      disk.virtpath = argv[optind+2];
>>      disk.unpluggable = 1;
>> -    disk.readwrite = ((argc-optind <= 2) || (argv[optind+3][0] == 'w'));
>> +    disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
> 
> This idiom is pretty nasty.  Perhaps we should rewrite it to:
> 
>   +    disk.readwrite = (argc-optind > 3) ? (argv[optind+3][0] == 'w') : 1;
> 
> or some such ?

Honestly, I don't really care.

Jan

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

end of thread, other threads:[~2010-09-21 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-21 11:13 [PATCH] xl: fix off-by-one mistake in block-attach handler Jan Beulich
2010-09-21 15:14 ` Ian Jackson
2010-09-21 16:05   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.