WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xl: fix off-by-one mistake in block-attach handl

To: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xl: fix off-by-one mistake in block-attach handler
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Tue, 21 Sep 2010 16:14:49 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 21 Sep 2010 08:15:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C98AF750200007800018169@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: chiark.mail.xen.devel
References: <4C98AF750200007800018169@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Jan Beulich writes ("[Xen-devel] [PATCH] xl: fix off-by-one mistake in 
block-attach handler"):
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> 
> --- 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.

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

<Prev in Thread] Current Thread [Next in Thread>