qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/5] qemu-io: Exit with error when a command fai


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/5] qemu-io: Exit with error when a command failed
Date: Mon, 30 Apr 2018 11:38:27 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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 <address@hidden>
---
  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 <address@hidden>

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]