From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgVSW-0001kc-Sp for qemu-devel@nongnu.org; Sat, 03 May 2014 04:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgVSS-0004EH-CN for qemu-devel@nongnu.org; Sat, 03 May 2014 04:38:12 -0400 Message-ID: <5364AAEE.7000500@msgid.tls.msk.ru> Date: Sat, 03 May 2014 12:38:06 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <1398725186-8202-1-git-send-email-kroosec@gmail.com> In-Reply-To: <1398725186-8202-1-git-send-email-kroosec@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] qmp: Report path ambiguity error. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hani Benhabiles , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?B?QW5kcmVhcyA=?= =?UTF-8?B?RsOkcmJlcg==?= , lcapitulino@redhat.com 29.04.2014 02:46, Hani Benhabiles wrote: > Signed-off-by: Hani Benhabiles > Suggested-by: Andreas F=C3=A4rber > --- > qmp.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > 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 *p= ath, Error **errp) > ObjectProperty *prop; > =20 > obj =3D object_resolve_path(path, &ambiguous); > - if (obj =3D=3D NULL) { > + if (ambiguous) { > + error_setg(errp, "Path '%s' is ambiguous", path); > + return NULL; > + } else if (obj =3D=3D 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 =3D object_resolve_path(path, &ambiguous); if (obj =3D=3D 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 N= ULL, ie, only on error path. Please note that object_resolve_path() does not initialize *ambiguous in all code paths. Thanks, /mjt