* [Qemu-devel] [Qemu-block][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat
@ 2016-10-10 3:07 Xu Tian
2016-10-14 15:39 ` [Qemu-devel] [Qemu-block] [PATCH] " Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Xu Tian @ 2016-10-10 3:07 UTC (permalink / raw)
To: qemu-devel, qemu-block; +Cc: kwolf, mreitz, famz, 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 <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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat
2016-10-10 3:07 [Qemu-devel] [Qemu-block][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat Xu Tian
@ 2016-10-14 15:39 ` Stefan Hajnoczi
2016-10-14 15:49 ` Kevin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-10-14 15:39 UTC (permalink / raw)
To: Xu Tian; +Cc: qemu-devel, qemu-block, kwolf, famz, mreitz
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
On Mon, Oct 10, 2016 at 11:07:09AM +0800, Xu Tian wrote:
> 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.
I suggest rewording the commit description:
img_rebase() returns 0 (success) when opening the backing file fails
because 'ret' isn't set.
> 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(+)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat
2016-10-14 15:39 ` [Qemu-devel] [Qemu-block] [PATCH] " Stefan Hajnoczi
@ 2016-10-14 15:49 ` Kevin Wolf
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2016-10-14 15:49 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Xu Tian, qemu-devel, qemu-block, famz, mreitz
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
Am 14.10.2016 um 17:39 hat Stefan Hajnoczi geschrieben:
> On Mon, Oct 10, 2016 at 11:07:09AM +0800, Xu Tian wrote:
> > 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.
>
> I suggest rewording the commit description:
>
> img_rebase() returns 0 (success) when opening the backing file fails
> because 'ret' isn't set.
I already reworded it a bit when I applied the patch (it was sent twice
somehow and I replied to the other one):
If the backing file cannot be opened when doing qemu-img rebase, the
variable 'ret' was not assigned a non-zero value, and the qemu-img
process terminated with exit code zero. Fix this.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-14 15:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10 3:07 [Qemu-devel] [Qemu-block][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat Xu Tian
2016-10-14 15:39 ` [Qemu-devel] [Qemu-block] [PATCH] " Stefan Hajnoczi
2016-10-14 15:49 ` Kevin Wolf
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).