From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btQwT-00035P-Fh for qemu-devel@nongnu.org; Sun, 09 Oct 2016 23:07:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btQwR-0007vl-BA for qemu-devel@nongnu.org; Sun, 09 Oct 2016 23:07:52 -0400 From: Xu Tian Date: Mon, 10 Oct 2016 11:07:09 +0800 Message-Id: <1476068829-17426-1-git-send-email-xutian@redhat.com> Subject: [Qemu-devel] [Qemu-block][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, famz@redhat.com, Xu Tian 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 --- 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