[libvirt] [PATCH] virsh: vol-upload disallow negative offset

John Ferlan jferlan at redhat.com
Wed Dec 3 12:42:26 UTC 2014



On 12/03/2014 02:53 AM, Shanzhi Yu wrote:
> In commit 570d0f, it should diable negative offset both in cmdVolDownload and
> cmdVolUpload according the description, while it really didn't in cmdVolUpload
> Disable it in this patch
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1087104
> Signed-off-by: Shanzhi Yu <shyu at redhat.com>
> ---
>  tools/virsh-volume.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

<sheepishly> - um wow, how did I miss that in the code especially after
changing the man page...

ACK

I will push shortly - I will adjust the commit message slightly to fix
the 'diable' typo and rephrase the issue:

Commit 570d0f63 describes disabling negative offset usage for
vol-upload/download (e.g. cmdVolDownload and cmdVolUpload; however,
the change was only made to cmdVolDownload. There was no change to
cmdVolUpload.  This patch adds the same check for vol-upload.

John

> diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
> index 27bd81d..d585ee2 100644
> --- a/tools/virsh-volume.c
> +++ b/tools/virsh-volume.c
> @@ -677,13 +677,13 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
>      const char *name = NULL;
>      unsigned long long offset = 0, length = 0;
>  
> -    if (vshCommandOptULongLongWrap(cmd, "offset", &offset) < 0) {
> -        vshError(ctl, _("Unable to parse integer"));
> +    if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
> +        vshError(ctl, _("Unable to parse offset value"));
>          return false;
>      }
>  
>      if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
> -        vshError(ctl, _("Unable to parse integer"));
> +        vshError(ctl, _("Unable to parse length value"));
>          return false;
>      }
>  
> 




More information about the libvir-list mailing list