[libvirt] [PATCH] esx: Fix error reporting in esxVI_LookupManagedObjectHelper

As the name parameter can be NULL the error message can only contain it conditionally. --- src/esx/esx_vi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 5fd0693..d0df13d 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -5140,8 +5140,14 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx, if (candidate == NULL) { if (occurrence != esxVI_Occurrence_OptionalItem) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find %s with name '%s'"), type, name); + if (name != NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find %s with name '%s'"), type, name); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find %s"), type); + } + goto cleanup; } -- 1.7.9.5

On 05/15/2013 03:44 PM, Matthias Bolte wrote:
As the name parameter can be NULL the error message can only contain it conditionally. --- src/esx/esx_vi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

2013/5/16 Eric Blake <eblake@redhat.com>:
On 05/15/2013 03:44 PM, Matthias Bolte wrote:
As the name parameter can be NULL the error message can only contain it conditionally. --- src/esx/esx_vi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
ACK
Thanks, pushed. -- Matthias Bolte http://photron.blogspot.com
participants (2)
-
Eric Blake
-
Matthias Bolte