From: Michael Tokarev <mjt@tls.msk.ru>
To: Hani Benhabiles <kroosec@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Andreas Färber" <afaerber@suse.de>,
lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] qmp: Report path ambiguity error.
Date: Sat, 03 May 2014 12:38:06 +0400 [thread overview]
Message-ID: <5364AAEE.7000500@msgid.tls.msk.ru> (raw)
In-Reply-To: <1398725186-8202-1-git-send-email-kroosec@gmail.com>
29.04.2014 02:46, Hani Benhabiles wrote:
> Signed-off-by: Hani Benhabiles <hani@linux.com>
> Suggested-by: Andreas Färber <afaerber@suse.de>
> ---
> qmp.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/qmp.c b/qmp.c
> index 74107be..0d49abf 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -199,7 +199,10 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
> ObjectProperty *prop;
>
> obj = object_resolve_path(path, &ambiguous);
> - if (obj == NULL) {
> + if (ambiguous) {
> + error_setg(errp, "Path '%s' is ambiguous", path);
> + return NULL;
> + } else if (obj == NULL) {
> error_set(errp, QERR_DEVICE_NOT_FOUND, path);
> return NULL;
> }
How about this:
--- a/qmp.c
+++ b/qmp.c
@@ -200,7 +200,9 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
obj = object_resolve_path(path, &ambiguous);
if (obj == NULL) {
- error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+ error_set(errp,
+ ambiguous ? "Path '%s' is ambiguous" : QERR_DEVICE_NOT_FOUND,
+ path);
return NULL;
}
The difference here is that we test "ambiguous" variable only if obj is NULL,
ie, only on error path. Please note that object_resolve_path() does not
initialize *ambiguous in all code paths.
Thanks,
/mjt
next parent reply other threads:[~2014-05-03 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1398725186-8202-1-git-send-email-kroosec@gmail.com>
2014-05-03 8:38 ` Michael Tokarev [this message]
2014-05-05 9:12 ` [Qemu-devel] [Qemu-trivial] [PATCH] qmp: Report path ambiguity error Michael Tokarev
2014-05-05 9:26 ` Andreas Färber
2014-05-05 9:31 ` Michael Tokarev
2014-05-05 9:37 ` [Qemu-devel] " Andreas Färber
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=5364AAEE.7000500@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=afaerber@suse.de \
--cc=kroosec@gmail.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).