On 04/28/2018 09:41 AM, Max Reitz wrote:
Currently, qemu-io basically always returns success when it gets to
interactive mode (so once the whole command line has been parsed; even
before the commands on the command line are interpreted).  That is not
very useful.

This patch makes qemu-io return failure when any of the executed
commands failed.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1519617
Signed-off-by: Max Reitz <mre...@redhat.com>
---
  qemu-io.c | 28 ++++++++++++++++++++++------
  1 file changed, 22 insertions(+), 6 deletions(-)


@@ -672,5 +683,10 @@ int main(int argc, char **argv)
blk_unref(qemuio_blk);
      g_free(readline_state);
-    return 0;
+
+    if (ret < 0) {
+        return 1;
+    } else {
+        return 0;
+    }

Would spelling this EXIT_SUCCESS/EXIT_FAILURE make it any more legible? But we aren't consistently using those anywhere else, so you aren't making it worse by using 0/1.

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to