Patchwork [12/13] savevm: update return value from qemu_savevm_state

login
register
mail settings
Submitter Pavel Hrdina
Date Jan. 9, 2013, 3:18 p.m.
Message ID <65434081d79cb01d31c29e58ba90366d995fdf77.1357741229.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/210744/
State New
Headers show

Comments

Pavel Hrdina - Jan. 9, 2013, 3:18 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 savevm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Eric Blake - Jan. 9, 2013, 10:39 p.m.
On 01/09/2013 08:18 AM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  savevm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 

> @@ -2189,6 +2189,7 @@ void qmp_vm_snapshot_save(bool has_name, const char *name, Error **errp)
>          error_setg(errp, "Failed to open '%s' file.", bdrv_get_device_name(bs));
>          goto the_end;
>      }
> +
>      ret = qemu_savevm_state(f, &local_err);

Spurious whitespace change?
Pavel Hrdina - Jan. 10, 2013, 10:35 a.m.
On Wed, 2013-01-09 at 15:39 -0700, Eric Blake wrote:
> On 01/09/2013 08:18 AM, Pavel Hrdina wrote:
> > Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> > ---
> >  savevm.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> 
> > @@ -2189,6 +2189,7 @@ void qmp_vm_snapshot_save(bool has_name, const char *name, Error **errp)
> >          error_setg(errp, "Failed to open '%s' file.", bdrv_get_device_name(bs));
> >          goto the_end;
> >      }
> > +
> >      ret = qemu_savevm_state(f, &local_err);
> 
> Spurious whitespace change?
> 

I'll fix that, thanks.

Patch

diff --git a/savevm.c b/savevm.c
index f9858cc..a7254b2 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1768,8 +1768,8 @@  static int qemu_savevm_state(QEMUFile *f, Error **errp)
         .shared = 0
     };
 
-    if (qemu_savevm_state_blocked(errp)) {
-        ret = -EINVAL;
+    ret = qemu_savevm_state_blocked(errp);
+    if (ret) {
         goto out;
     }
 
@@ -1793,7 +1793,7 @@  out:
         }
     }
 
-    return ret;
+    return ret == 0 ? 0 : -1;
 }
 
 static int qemu_save_device_state(QEMUFile *f)
@@ -2189,6 +2189,7 @@  void qmp_vm_snapshot_save(bool has_name, const char *name, Error **errp)
         error_setg(errp, "Failed to open '%s' file.", bdrv_get_device_name(bs));
         goto the_end;
     }
+
     ret = qemu_savevm_state(f, &local_err);
     vm_state_size = qemu_ftell(f);
     qemu_fclose(f);