From: Fam Zheng <famz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
jsnow@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/4] qemu-io: Don't die on second open
Date: Wed, 24 May 2017 14:28:33 +0800 [thread overview]
Message-ID: <20170524062833.GO12279@lemon.lan> (raw)
In-Reply-To: <20170519023233.24461-2-eblake@redhat.com>
On Thu, 05/18 21:32, Eric Blake wrote:
> Failure to open a file in qemu-io should normally return 1 on
> failure to end the command loop, on the presumption that when
> batching commands all on the command line, failure to open means
> nothing further can be attempted. But when executing qemu-io
> interactively, there is a special case: if open is executed a
> second time, we print a hint that the user should try the
> interactive 'close' first. But the hint is useless if we don't
> actually LET them try 'close'.
>
> This has been awkward since at least as far back as commit
> 43642b3, in 2011 (probably earlier, but git blame has a harder
> time going past the file renames at that point).
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> qemu-io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qemu-io.c b/qemu-io.c
> index 34fa8a1..0c82dac 100644
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -63,7 +63,7 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
> if (qemuio_blk) {
> error_report("file open already, try 'help close'");
> QDECREF(opts);
> - return 1;
> + return 0;
> }
>
> if (force_share) {
> --
> 2.9.4
>
>
Hmm, failure is failure, why is "return 0" better than "return 1"?
If the control flow in the caller has a problem, fix it there? Specifically, I
don't think failed interactive open need to exit program, at all.
Fam
next prev parent reply other threads:[~2017-05-24 6:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 2:32 [Qemu-devel] [PATCH 0/4] more blkdebug tweaks Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 1/4] qemu-io: Don't die on second open Eric Blake
2017-05-24 6:28 ` Fam Zheng [this message]
2017-05-24 13:43 ` Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 2/4] block: Guarantee that *file is set on bdrv_get_block_status() Eric Blake
2017-05-24 15:03 ` Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 3/4] block: Simplify use of BDRV_BLOCK_RAW Eric Blake
2017-05-22 20:23 ` Eric Blake
2017-05-19 2:32 ` [Qemu-devel] [PATCH 4/4] blkdebug: Support .bdrv_co_get_block_status Eric Blake
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=20170524062833.GO12279@lemon.lan \
--to=famz@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.