[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] qmp: Report path ambiguity error.
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-trivial] [PATCH] qmp: Report path ambiguity error. |
Date: |
Sat, 03 May 2014 12:38:06 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 |
29.04.2014 02:46, Hani Benhabiles wrote:
> Signed-off-by: Hani Benhabiles <address@hidden>
> Suggested-by: Andreas Färber <address@hidden>
> ---
> 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
- Re: [Qemu-trivial] [PATCH] qmp: Report path ambiguity error.,
Michael Tokarev <=