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

2014-12-02 Thread Shanzhi Yu
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 
---
 tools/virsh-volume.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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;
 }
 
-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2014-12-03 Thread John Ferlan


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 
> ---
>  tools/virsh-volume.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

 - 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;
>  }
>  
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list