qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xu Tian <xutian@redhat.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, famz@redhat.com,
	Xu Tian <xutian@redhat.com>
Subject: [Qemu-devel] [Qemu-block][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat
Date: Mon, 10 Oct 2016 11:07:09 +0800	[thread overview]
Message-ID: <1476068829-17426-1-git-send-email-xutian@redhat.com> (raw)

If backing file can not open when do image rebase, flag 'ret' not
assign a non-zero value, then qemu-img process exit with code zero.
Assign value '-1' to flag 'ret' after report error message to fix
this defeat.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1383012

Signed-off-by: Xu Tian <xutian@redhat.com>
---
 qemu-img.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qemu-img.c b/qemu-img.c
index 46f2a6d..37dcade 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2918,6 +2918,7 @@ static int img_rebase(int argc, char **argv)
             error_reportf_err(local_err,
                               "Could not open old backing file '%s': ",
                               backing_name);
+            ret = -1;
             goto out;
         }
 
@@ -2935,6 +2936,7 @@ static int img_rebase(int argc, char **argv)
                 error_reportf_err(local_err,
                                   "Could not open new backing file '%s': ",
                                   out_baseimg);
+                ret = -1;
                 goto out;
             }
         }
-- 
2.5.5

             reply	other threads:[~2016-10-10  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10  3:07 Xu Tian [this message]
2016-10-14 15:39 ` [Qemu-devel] [Qemu-block] [PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat Stefan Hajnoczi
2016-10-14 15:49   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476068829-17426-1-git-send-email-xutian@redhat.com \
    --to=xutian@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).